9

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
4
  • did you also run npm install node-sass? Commented Jul 29, 2019 at 6:50
  • Please refer this stackoverflow.com/a/52581213/795683 Commented Jul 29, 2019 at 6:51
  • @EstebanGehring yes tried that also ... but not helped ... Commented Jul 29, 2019 at 7:12
  • @SainPradeep tried with the link provided ... but this also not worked. Commented Jul 29, 2019 at 7:19

4 Answers 4

4

Try this, this solved my problem once

npm install node-sass -g 
Sign up to request clarification or add additional context in comments.

Comments

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.

2 Comments

@TusharG - Could you post the package.json, and did you try this npm install --save-dev --unsafe-perm node-sass?
@TusharG - Also do check this out github.com/angular/angular-cli/issues/…
0

Install

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

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

Credit https://github.com/xzyfer

Comments

0

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

Comments

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.