"npm prune --production" breaks Netlify CI
Everything works correctly on my local machine but on Netlify im getting this error on the postinstall-build hook:
npm ERR! May not delete: /opt/build/repo/node_modules/react-polymorph/node_modules/.bin
11:37:56 AM: npm ERR! A complete log of this run can be found in:
11:37:56 AM: npm ERR! /opt/buildhome/.npm/_logs/2018-03-22T10_37_56_856Z-debug.log
11:37:56 AM: postinstall-build:
11:37:56 AM: Error: Command failed: sh -c "/opt/buildhome/.nvm/versions/node/v8.2.1/bin/node" "/opt/buildhome/.nvm/versions/node/v8.2.1/lib/node_modules/npm/bin/npm-cli.js" prune --production
11:38:51 AM: npm
Any ideas how to solve this issue?
Are you running the same version of npm locally that is on Netlify? The most useful info would be both versions of npm.
btw, if you have the luxury of requiring newer versions of npm and Yarn for your postinstall build hook to work, you can ditch postinstall-build altogether because npm added native support for it! I need to update the README with this info. You can try using the prepare lifecycle hook instead of postinstall-build, and if that works then it's preferable. :)
@exogen yeah i was running the same versions … i guess it's probably a problem with privileges on Netlify? Thanks for the info about newer npm versions … i will give this a try!