Error: Cannot find module 'node-sass' In Angular 7

Dung Do Tien Nov 24 2020 715

I have a project web with angular 7 after re-install win 10 I get code from git and run ng serve -o, I got an error Error: Cannot find module 'node-sass'.

ERROR in ./src/scss/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/scss/style.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'
Require stack:
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\sass-loader\lib\loader.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\loader-runner\lib\loadLoader.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\loader-runner\lib\LoaderRunner.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\webpack\lib\NormalModule.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\webpack\lib\NormalModuleFactory.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\webpack\lib\Compiler.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\webpack\lib\webpack.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular-devkit\build-webpack\src\webpack\index.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular-devkit\build-webpack\src\index.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular-devkit\architect\src\architect-legacy.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular-devkit\architect\src\index.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular\cli\models\architect-command.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular\cli\commands\build-impl.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular-devkit\schematics\tools\export-ref.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular-devkit\schematics\tools\index.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular\cli\utilities\json-schema.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular\cli\models\command-runner.js
- D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\longnh1\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
- C:\Users\longnh1\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:900:15)
    at Function.Module._load (node:internal/modules/cjs/loader:745:27)
    at Module.require (node:internal/modules/cjs/loader:972:19)
    at require (node:internal/modules/cjs/helpers:88:18)
    at Object.sassLoader (D:\DaiViet\Project\Indian\admin_angular\DVG.APA.CMSClient\node_modules\sass-loader\lib\loader.js:46:72)
ERROR in ./src/app/plugins/filemanager/filemanager.component.scss
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'
Require stack:

 

Have 2 answer(s) found.
  • S

    Sandeep Kumar Nov 24 2020

    I try with the command npm i node-sass but it does not work for me. 

    The solution worked for me is npm install --save-dev node-sass.

  • M

    Marry Christ Nov 24 2020

    I run the command below, it's working for me.

    npm install --save-dev  --unsafe-perm node-sass 
    
Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close