Reputation: 505
I am running an angular project in my local environment with versions specified below.
npm version : 6.9.0
Angular CLI: 7.3.9
Node: 10.16.0
OS: win32 x64
and i cannot run project and get the errors below:
ERROR in ./src/assets/styles/style.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/assets/styles/style.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.sassLoader (..\node_modules\sass-loader\lib\loader.js:46:72)
ERROR in ./src/app/modules/shared/components/loader/loader.component.scss
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.sassLoader (..\node_modules\sass-loader\lib\loader.js:46:72)
i 「wdm」: Failed to compile.
i have tried deleting node_modules and reinstalling it also
Delete `package-lock.json` file.
Go to node_module folder and `run rm -rf node_modules`.
Run `npm install`
npm rebuild --force
npm rebuild node-sass --force
Upvotes: 9
Views: 16038
Reputation: 24406
Try this, this solved my problem once
npm install node-sass -g
Upvotes: 4
Reputation: 5742
Install
npm install --save-dev --unsafe-perm node-sas
https://github.com/sass/node-sass/issues/2536
Credit https://github.com/xzyfer
Upvotes: 0
Reputation: 116
Try to run npm audit fix
to update your dependencies. I had faced a similar issue and was able to fix by running it.
Upvotes: 1