Skip to content

C2LC-434: Run 'npm rebuild' before Netlify build #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2021

Conversation

sbates-idrc
Copy link
Contributor

Netlify builds are failing due to Netlify caching node-sass from npm install. When the version of Node is updated, Netlify continues to use the cached node_modules with the new version of Node. In the case of node-sass, the build done at npm install is Node version specific. And the caching of node-sass fails the build.

Example log of a failure from Netlify:

3:32:45 PM: $ npm run build
3:32:45 PM: > c2lc-coding-environment@0.9.0 build /opt/build/repo
3:32:45 PM: > react-scripts build
3:32:47 PM: Creating an optimized production build...
3:33:48 PM: Failed to compile.
3:33:48 PM: 
3:33:48 PM: ./src/index.scss
3:33:48 PM: Missing binding /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
3:33:48 PM: Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 12.x
3:33:48 PM: Found bindings for the following environments:
3:33:48 PM:   - Linux 64-bit with Node.js 10.x
3:33:48 PM: This usually happens because your environment has changed since running `npm install`.
3:33:48 PM: Run `npm rebuild node-sass` to download the binding for your current environment.

@sbates-idrc
Copy link
Contributor Author

See point 2 of https://answers.netlify.com/t/support-guide-my-site-deploy-fails-unless-netlifys-build-cache-is-cleared/3035

"2. Your dependencies have binary components, which need to be rebuilt for some reason. For instance, if the version of Node.js we use to build changes, any binary modules built against the old version are unlikely to work with the new version - BUT we also may not rebuild them if they are cached already!"

Point 10 "Build cache" of https://answers.netlify.com/t/support-guide-frequently-encountered-problems-during-builds/213 contains some information on what is cached.

@sbates-idrc sbates-idrc merged commit 53c915d into codelearncreate:develop-0.9 Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant