I’m a Developer Advocate at Prisma 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.
👋🏼 @danielnorman
Unfortunately there isn’t a way to disable
node_modules
caching currently. You’re right about the cache being dependent on the contents ofpackage-lock.json
(oryarn.lock
).If a cached
node_modules
directory is available and the lockfile matches, it will be used andnpm 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 cachednode_modules
is reused from a previous build. Would addingnpm 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.