I’m a Developer Advocate at [Prisma](www.prisma.io) and a user reported problems when deploying an app that uses Prisma to the App Platform.

Prisma relies on code generation during the build process to function properly. The code is generated into the node_modules folder.

If you look at the error that the user encountered, it appears that the reason might be the way that you cache the node_modules folder. It seems that changes to the package-lock.json file clears the cache.

Is there a way to either disable the caching or provide a workaround so that code generated into the node_modules folder during the build will be included in the release?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

👋🏼 @danielnorman

Unfortunately there isn’t a way to disable node_modules caching currently. You’re right about the cache being dependent on the contents of package-lock.json (or yarn.lock).

If a cached node_modules directory is available and the lockfile matches, it will be used and npm ci/npm install will not be run at all.

I’m not familiar with how Prisma’s generated code works, but looking at the GitHub discussion you linked, it seems like the problem is due to a postinstall script not being run when a cached node_modules is reused from a previous build. Would adding npm install to the build command work? For example: npm install && npx prisma generate.

And just to confirm, NODE_MODULES_CACHE is not a supported config option.