Developer Advocate @ Prisma
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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.