Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: ENOENT: no such file or directory, scandir '.../node_modules/node-sass/vendor'

I am having an issue running my node application on a different computer than the one I usually use. After a lot of troubleshooting:

The error message I'm getting is:

Error: ENOENT: no such file or directory, scandir '.../node_modules/node-sass/vendor'

A posting that I was reading suggested that I run sudo npm install -g node-sass, which gives me the following error:

Error: EACCES: permission denied, mkdir '...nvm/versions/node/v8.9.0/lib/node_modules/node-sass/build'

I then tried to run sudo npm rebuild node-sass but I'm getting the same error message:

Error: EACCES: permission denied, mkdir '.../node_modules/node-sass/build'

I then ran sudo npm install -g node-sass --unsafe-perm=true --allow-root but it also didn't work:

ENOENT: no such file or directory, scandir '.../node_modules/node-sass/vendor'

What am I doing wrong here? Why isn't node-sass working? Why isn't sudo working properly?

like image 806
maudulus Avatar asked May 28 '19 19:05

maudulus


2 Answers

Windows. Try below

node node_modules/node-sass/scripts/install.js
npm rebuild node-sass
like image 179
Kairat Koibagarov Avatar answered Sep 18 '22 08:09

Kairat Koibagarov


  1. Most probably it's not node-sass issue. This sometimes happens when you use different OS to install node-sass. As it uses some native components, the npm install must only be done one OS. Do not copy node_modules from some other place. Do a fresh install.

  2. Have you tried deleting the node_modules directory and running npm install again?

  3. Are you working on Windows machione where the npm install was done using a Ubuntu shell (inside windows) and now you are trying to install again from the windows command line? If so, dont. Use only one shell.

  4. Finally if none of these help, then its possible a user permission issue. Check if you can get super user access sudo su - and then try doing a fresh npm install.

like image 37
Sohail Avatar answered Sep 21 '22 08:09

Sohail