8

I am running a anglar project in my local environment. with below specified vesions. and i cannot run project and get the errors below: npm version : 6.9.0 Angular CLI: 7.3.9 Node: 10.16.0 OS: win32 x64

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
TusharG
  • 495
  • 2
  • 4
  • 20

4 Answers4

3

Try this, this solved my problem once

npm install node-sass -g 
SoldierCorp
  • 7,610
  • 16
  • 60
  • 100
Muhammed Albarmavi
  • 23,240
  • 8
  • 66
  • 91
1

Try to run npm audit fix to update your dependencies. I had faced a similar issue and was able to fix by running it.

Govind Sah
  • 116
  • 10
  • @TusharG - Could you post the package.json, and did you try this `npm install --save-dev --unsafe-perm node-sass`? – Govind Sah Jul 29 '19 at 07:29
  • @TusharG - Also do check this out https://github.com/angular/angular-cli/issues/12746#issuecomment-433337619 – Govind Sah Jul 29 '19 at 07:34
0

Install

npm install --save-dev --unsafe-perm node-sas

https://github.com/sass/node-sass/issues/2536

Credit https://github.com/xzyfer

Chanaka Weerasinghe
  • 5,404
  • 2
  • 26
  • 39
0

Try to uninstall using npm uninstall and again try to install.