简体   繁体   中英

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?

Windows. Try below

node node_modules/node-sass/scripts/install.js
npm rebuild node-sass
  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.

Your user does not has the rights to write in the folder you are trying. You are using 3 ... so it goes to the folder /Users on the second one you have ...nvm/versions/node/v8.9.0/lib/node_modules

This is because of a missing node-sass dependency or broken node-sass package issue.

You can resolve this by the following steps:

  • Install node-sass globally, if it is not installed in your system.

     npm install -g node-sass
  • Open command prompt/terminal on the project root directory and execute the following commands.

     nodejs node_modules/node-sass/scripts/install.js npm rebuild node-sass

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM