libsass bindings not found when running gulp dist

2019-09-06 02:58发布

问题:

I'm trying to use a gulp project on my Linux machine. The readme for the project tells me to first run sudo npm install -g gulp bower, then in the project directory run sudo npm install and then bower install. Everything up to this point works just fine for me. However, after that I try to run gulp dist and get this error:

Error: `libsass` bindings not found in /[PROJECT DIRECTORY]/trunk/node_modules/gulp-sass/node_modules/node-sass/vendor/linux-x64-14/binding.node. Try reinstalling `node-sass`?

Googling that error produced this: libsass bindings not found when using node-sass in nodejs, which I tried, but that didn't fix anything. When I looked through that directory that gulp said it couldn't find the difference was the linux-x64-14, mine said linux-x64-11, so I'm assuming I have the wrong version? Just for fun I decided to try changing the name of that folder to what it wanted, and I got a different error:

Error: Module did not self-register.

The really strange thing about all this is that when I tried getting this project working on my Windows machine I didn't have any of these issues, it just worked. I have no idea what I'm doing wrong, any ideas?

回答1:

I've solved this by updating GCC from 4.4.x to 4.7.x. Because GCC 4.4.x cannot compile node-sass of current version.



回答2:

It worked for me using below commands. Try it

npm rebuild node-sass

rm -rf node_modules

npm i


回答3:

This error usually shows up for us when we update our node or io.js version.

I would recommend deleting your node_modules folder and running npm install again.

If that doesn't work it is probably worth deleting your npm cache. There are a number of ways to do it including just a simple npm cache clean

I would also recommend deleting your ~/.npm folder as well just to be sure.

If this doesn't work let me know and we can start debugging your actual Node version and your package.json