'ERROR in ./node_modules/css-loader?

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\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\vendor' at Object.fs.readdirSync (fs.js:911:18) at Object.getInstalledBinaries (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\extensions.js:124:13) at foundBinariesList (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\errors.js:20:15) at foundBinaries (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\errors.js:15:5) at Object.module.exports.missingBinary (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\errors.js:45:5) at module.exports (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\binding.js:15:30) at Object. (C:\Users\Jaaayz\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\Jaaayz\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

I tried googline it and do everything about it but didn't find any solution.

node -v 8.5.0

Angular CLI version 1.4.3

Appreciate if someone calp help. Thanks in advance.



Solution 1:[1]

Try this

npm install node-sass

Then

npm run start

Solution 2:[2]

Run this command:

npm install --save node-sass

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

Solution 3:[3]

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

Solution 4:[4]

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

Solution 5:[5]

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

Solution 6:[6]

Try to run

npm i node-sass@latest

Solution 7:[7]

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

npm install node-sass@v4

Solution 8:[8]

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.

Solution 9:[9]

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

Solution 10:[10]

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"

Solution 11:[11]

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

Solution 12:[12]

Add the below code in your package.json:

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

Solution 13:[13]

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