Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR in Cannot find module 'node-sass'

Config: macOS High Sierra, version 10.13.2, node:v8.1.2 npm:5.0.3 When I run npm start in my angularjs project I get this error:

ERROR in Cannot find module 'node-sass'

After this I run:

npm i node-sass

Now I get this error:

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1

Why won't npm install node-sass? How can I install node-sass?

like image 203
bier hier Avatar asked Oct 20 '22 15:10

bier hier


2 Answers

Here's the solution:

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

Enjoy!

Edited to explain the options (from comments):

--save-dev is used so that your app is able to find the module in local node_modules. --save-dev adds package to devDependencies in package.json. --unsafe--perm is used to run install scripts as root. To avoid sudo, use nvm instead. --unsafe--perm is really not needed as sudo is already mentioned. So the command basically air tights the script to install node-sass at any cost.

like image 531
Alex Onozor Avatar answered Oct 22 '22 05:10

Alex Onozor


  1. This error is for node-sass is not present ... to solve this just you want to run following command

npm install node-sass

like image 111
kedar kokil Avatar answered Oct 22 '22 03:10

kedar kokil