43

I was trying to run an angular project in windows 10. It is the same project that I am doing in Ubuntu. When I clone the repository and install all the node packages I encountered this error.

ERROR in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader?{"ident":"postcss"}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/scss/style.scss Module build failed: Error: ENOENT: no such file or directory, scandir 'C:\Users\me\Documents\ad-fingerprinting\web\node_modules\node-sass\vendor' at Object.fs.readdirSync (fs.js:911:18) at Object.getInstalledBinaries (C:\Users\me\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\extensions.js:124:13) at foundBinariesList (C:\Users\me\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\errors.js:20:15) at foundBinaries (C:\Users\me\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\errors.js:15:5) at Object.module.exports.missingBinary (C:\Users\me\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\errors.js:45:5) at module.exports (C:\Users\me\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\binding.js:15:30) at Object. (C:\Users\me\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\index.js:14:35) at Module._compile (module.js:624:30) at Object.Module._extensions..js (module.js:635:10) at Module.load (module.js:545:32) at tryModuleLoad (module.js:508:12) at Function.Module._load (module.js:500:3) at Module.require (module.js:568:17) at require (internal/module.js:11:18) at Object. (C:\Users\me\Documents\ad-fingerprinting\web\node_modules\sass-loader\lib\loader.js:3:14) at Module._compile (module.js:624:30) @ ./src/scss/style.scss 4:14-195 @ multi ./src/scss/style.scss

node -v 8.5.0

Angular CLI version 1.4.3

3
  • are you using sass ? Commented Sep 26, 2017 at 6:24
  • yes I am using material sass Commented Sep 26, 2017 at 6:27
  • Update node to latest version! Commented Jan 6, 2021 at 13:42

13 Answers 13

105

Try this

npm install node-sass

Then

npm run start

Sign up to request clarification or add additional context in comments.

7 Comments

@FadiAboMsalam it worked for me too. Could you explain us a little bit about the answer.
holy sith. i was at the verge of giving up after a Vue project i had abandoned not so long ago was giving me tons of errors!! and this just saved me. autoupvote
This failed for me, but I ran the npm install again, it started to work!
Can anybody provide a YouTube link for npm basics? Where do I start?
@Moojjoo checkout this its helpful youtube.com/watch?v=2V1UUhBJ62Y
|
21

Run this command:

npm install --save node-sass

This does the same as above. Similarly to the answer above.

Comments

14

I am also facing the same problem, but I resolve.

npm install node-sass  

Above command work for me. As per your synario you can use the blow command.

Try 1

 npm install node-sass

Try 2

Remove the node_modules folder and run:

npm install

Try 3

npm rebuild node-sass

Try 4

npm install --save node-sass

For your ref you can go through this github link

Comments

3

I tried both

npm rebuild node-sass

and

npm install --save node-sass

Later by seeing EACCESS, i checked the folder permission of /node_modules, which was not 777 permission

Then I gave

chmod -R 777 *

-R for recursively(setting the same permission not in the dir but also inside nested sub dir)

  • is for all files in current directory

What is file permission

To check for permission you can use

ls -l

If u don't know about it, first see here, then check the url

Every file and directory has permission of 'rwx'(read, write, execute). and if 'x' permission is not there, then you can not execute, if no 'w', you can not write into the file. if something is missing it will show in place of r/w/x with '-'. So, if 'x' permission is not there, it will show like 'rw-'

And there will be 3 categories of user Owner(who created the file/directory), Group(some people who share the same permission and user privilege), Others(general public)

So 1st letter is 'd'(if it is a directory) or '-'(if it is not a directory), followed by rwx for owner, followed by for group, followed by other

drwxrwxrwx

For example, for 'node_modules'directory I want to give permission to the owner all permission and for rest only read, then it will be

drwxr--r--

And about the number assume for 'r/w/x' it is 1 and for '-' it is 0, 777, first 7 is for the owner, followed by the group, followed by other

Let's assume the permission is rwxr-xrw-

Now 'rwx' is like '111' and its equivalent decimal is 12^2+12^1+1*2^0=7

Now 'r-x' is like '101' and its equivalent decimal is 12^2+02^1+1*2^0=5

Now 'rw-' is like '110' and its equivalent decimal is 12^2+12^1+0*2^0=6

So, it will be 756

2 Comments

better to explain , then to add a link to different site ( which may delete later and thus become of no use if this answer got more upvotes)
Got it Prashant
2

Laravel Mix 4 switches from node-sass to dart-sass (which may not compile as you would expect, OR you have to deal with the issues one by one)

OR

npm install node-sass


mix.sass('resources/sass/app.sass', 'public/css', {
implementation: require('node-sass')
});

https://laravel-mix.com/docs/4.0/upgrade

Comments

2

re-install node-sass with version based on your error message

npm install node-sass@v4

Comments

1

Try to run

npm i node-sass@latest

2 Comments

How is this different from other answers?
This question is almost 2 years old, with an accepted answer and the provided answer was flagged for review as a Low Quality Post. Here are some guidelines for How do I write a good answer?. This provided answer may be correct, but it could benefit from an explanation. Code only answers are not considered "good" answers. From review.
0

you have to update your node.js and angular/cli.If you update these two things then your project has angular.json file instead of angular-cli.json file.Then add css file into angular.json file.If you add css file into angular-cli.json file instead of angular.json file,then errors are occured.

Comments

0

My case:

Missing node-sass in package.json

Solution:

  1. npm i --save node-sass@latest
  2. remove node-modules folder
  3. npm i
  4. check "@angular-devkit/build-angular": "^0.901.0" version in package.json

Comments

0

Step 1: goto /node_modules/node-sass folder

Step 2: run yarn install or npm install

If it complains about version incompatibility, try installing older node-sass versions

And repeat Step 1, Step 2

OR you can add this script in the package.json

"postinstall": "node ./node_modules/node-sass/scripts/install.js"

Comments

0

To be clear node-sass is depracated and must be uninstalled and then a new version of sass must be install.

Do the follow:

1st) try uninstalling it by using this command

npm uninstall node-sass

and then 2nd) try installing sass

npm install --save-dev sass

this worked for me when I was having issues installing sass on a project using create react app

Comments

0

Add the below code in your package.json:

"devDependencies": {
  "sass": "^1.49.0"
}

Comments

0
rm -r ./node_modules
npm cache clean --force
npm rebuild node-sass
npm i
npm start

1 Comment

See "Explaining entirely code-based answers". While this might be technically correct, it doesn't explain why it solves the problem or should be the selected answer. We should educate along with helping solve the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.