build-image
build-image copied to clipboard
npm preinstall and postinstall scripts are not run
npm preinstall and postinstall scripts are not run, resulting in breaking builds that are valid outside of Netlify.
This is caused by our caching mechanism only restoring the node_modules/
directory:
https://github.com/netlify/build-image/blob/d84c79427e8f83c1ba17bcdd7b3fe38059376b68/run-build-functions.sh#L478
And then running npm install conditionally:
https://github.com/netlify/build-image/blob/d84c79427e8f83c1ba17bcdd7b3fe38059376b68/run-build-functions.sh#L149-L153
An existing PR fixes this: #510.
What's the status on this? I'm running into this on the focal
image.
Is it possible to add other folders to be cache in netlify.toml at all?
I haven't seen anything outside the docs though.
Currently breaks builds that use playwright because the browser images are cached outside node_modules.
OK idea for peeps out there stuck wthith is issue: I'm just running my "postinstall" command before the npm build command in Netlify config now.
npx [my postinstalll]] && npm run build
Just got bit by this breaking our environments because patch-package
wasn't run. 😬
@jobala Thanks for the PR, a quick review seems to indicate this issue is only fixed for npm
users but not for yarn
users? Is that correct?