I am currently running a Node v10.19.0 / Nextjs8 project locally. I want to further upgrade the Next version to 11. I start by upgrading the version of node itself to 12.14.0 (maybe 12.20.1 is better?) And I get 2 errors:
> Location: "/home/roma/project/.babelrc" [ error ] ./styles/main.scss Error: Missing binding /home/roma/project/node_modules/node-sass/vendor/linux-x64-72/binding.node Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 12.x Found bindings for the following environments: - Linux 64-bit with Node.js 10.x This usually happens because your environment has changed since running `npm install`. Run `npm rebuild node-sass` to download the binding for your current environment. Error: Cannot find module '/home/roma/project/.next/build-manifest.json' Require stack: - /home/roma/project/node_modules/next-server/dist/server/load-components.js - /home/roma/project/node_modules/next-server/dist/server/next-server.js - /home/roma/project/node_modules/next/dist/server/next-dev-server.js - /home/roma/project/node_modules/next/dist/server/next.js - /home/roma/project/server/server.ts
I understand that I need to run the npm rebuild node-sass command.
At the moment, I have not entered this command yet, since at any time it may be necessary to return to the old version and quickly do some work to fix the problems, so I would like to clarify these two questions.
Thanks for any help and have a nice day.
Like you noticed, this happens because your environment has changed since running npm install. Just run
npm rebuild node-sass to build the binding for your current environment and you should be good.
Note that if for any reason you need to switch back to another Node version, you'll need to rebuild again.
I've used that command way too many times, almost every other week. From my experience and what I've researched, there's not much that can be done to prevent this from happening; it's a compatibility issue with node-sass and node versions.
If the rebuild command hangs (never happened to me but it could) you could either:
--force flag at the end of the rebuild command OR
node_packages folder and re-run the install script
I've never had to do any of these but I've read some people have.
There seems to be more info around in the site with similar questions, like this one: Issue using node-sass after updating NodeJS
Hope this helps. Cant add comments so gave my best shot at a complete answer.