Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Fails: `npm rebuild node-sass --force`

Using n to switch Node versions. I've ran yarn, npm rebuild node-sass --force many many times. And still fails. Getting this error:

Node Sass could not find a binding for your current environment

This usually happens because your environment has changed since running `npm install`. Run `npm rebuild node-sass --force` to build the binding for your current environment. 

Anyone have any idea how to fix?

Also.. When running this command..

npm rebuild node-sass --force 

I get..

npm WARN using --force I sure hope you know what you are doing. 

Doens't seem like it is doing anything..

like image 631
GN. Avatar asked Nov 02 '18 20:11

GN.


People also ask

Why do I have to rebuild node sass?

When you change the version of Node. js used on your project, then the binding needs to be rebuild so that node-sass can be imported and executed from your code. Once the rebuild is finished, run the project again. Once done, you should be able to run the project without any errors.

What is npm install sass?

<57. Node-sass is a library that provides binding for Node. js to LibSass, the C version of the popular stylesheet preprocessor, Sass. It allows you to natively compile . scss files to css at incredible speed and automatically via a connect middleware.


2 Answers

I did below to resolve the issue.

npm uninstall node-sass npm i node-sass npm rebuild node-sass 
like image 53
antimatter Avatar answered Sep 22 '22 03:09

antimatter


remove node-sass from your command and just run npm rebuild --force

like image 41
user2240097 Avatar answered Sep 20 '22 03:09

user2240097