Search code examples
javascriptangularnode-modules

Cannot find module 'node-sass' while running the angular 7 application


I am trying to run my application but I am getting the below error.

ERROR in ./src/styles.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/styles.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:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object.sassLoader (C:\Users\xxx\xxx\App\xxxx\node_modules\sass-loader\lib\loader.js:46:72) ERROR in ./src/app/widget-modules/xxxxx/xxxx.component.ts Module not found: Error: Can't resolve './xxxxx.component.scss' in 'C:\Users\oooo\mmmm\App\zzzz\src\app\yyyy\xxxx'.

I tried installing node-sass with below commands but nothing's working. I am also getting the python error when I try to run below commands.

    npm i node-sass
    npm i --save node-sass
    npm i --save-dev node-sass
    npm install --save-dev  --unsafe-perm node-sass

Error:

can't find python executable python you can set the python env variable.

Also I deleted the node_modules folder and reinstalled but not working.


Solution

  • I know this is late answer, but it may be help for some one in future

    The same problem ,I faced.In my case, I installed npm by using force with below command

    npm install --force