Error: Cannot find module node-sass, error on second build

I’m trying to deploy a statics site that has a build step to compile sass. The node-sass module appears to be installed at the start of the process, but when node-sass is actually called it’s missing a file. To make it weird, it sometimes succeeds.

https://app.netlify.com/sites/doublefront

I tried changing the version of node-sass in package.json, tried clearing the cache on netlify and I followed the general guidelines outlined in sticky post above (except running a local docker image)

I get this (on clear cache deploy)

`Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-64/binding.node`

And then (sometimes)

`Error: Cannot find module '/opt/build/repo/node_modules/node-sass/vendor/linux-x64-64/binding.node'`

I kind of fixed my problem by using sass (pure javascript implementation) instead of node-sass. It might be possible there’s something wrong with the release binary of node-sass.

Awesome actually I think that node-sass is built in JavaScript and sass is actually built using the Dart language.

I’ve run into this problem before myself :joy::+1:

Here’s the solution:

sudo npm install --save-dev --unsafe-perm node-sass

Enjoy!

If thist doesn’t work try to install from a mirror

Full Source Code Available At Here

The buildbot on Netlify does not have sudo access so your command won’t work. The issue, I think is that node-sass has a binary component to it, while sass is purely written in Dart. You could add npm rebuild && to the front of your build command to force binary components to be rebuilt before proceeding with your build command.