2

After installation of Node.js (10.x & 11.X) versions while running the angular projects (ng serve -0) I get the following error message.

ERROR in ./src/styles.scss (./node_modules/@angular-devkit/build-angular/src/ang ular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embe dded!./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:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object.sassLoader (E:\Projects\my-app\node_modules\sass-loader\lib\loader .js:46:72) i ?wdm?: Failed to compile.

I have gone through a lot of stack overflow questions and angular forum but none of the solutions provided are working for me.

I have tried the following commands :

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

npm rebuild node-sass --force

npm install --save-dev @angular-devkit/build-angular

ng update @angular/cli

I also tried updating the npm as well with the command : npm install -g npm@latest

I have gone through the question : ERROR in Cannot find module 'node-sass'

But none of the code helps. I tried reinstalling node with different versions but still the same error is being thrown.

Screenshot : https://i.stack.imgur.com/yR18I.jpg

Edit 1 Please take a look at this github thread

I tried changing the sass in the angular.json file as mentioned in the thread but still the issue persists.

Edit 2 I have updated the images in the imagur link The first image shows a response from CLI after successful creation of an angular project. The rest of the four images display the console details of the system having issue in running Angular 7.

I am also adding the pastebin for the aforementioned :

  1. Without Issue
  2. System with Issue

Edit 3

The Angular version details is provided below <code>ng version</code>

Krishna Chandran
  • 389
  • 3
  • 18
  • did you try `npm rebuild node-sass --force` ? – Mustapha Larhrouch Apr 10 '19 at 11:17
  • Check below solution that solved mine problem. [Solved sass](https://stackoverflow.com/questions/54463979/angular-7-cli-generated-project-throws-error-in-multi-src-styles-sass) – Mukesh Fulwariya Apr 10 '19 at 11:21
  • @MustaphaLarhrouch : yes I have tried that as well! but not working for me. – Krishna Chandran Apr 10 '19 at 11:30
  • @MukeshFulwariya : where should I add it? under the architect object or under the schematics object? I replaced it in both the objects still it doesn't help. Please take a look at : https://imgur.com/a/1iKNcw0 – Krishna Chandran Apr 10 '19 at 11:41
  • You need to update your angular cli as well with latest support of node js. Please try to install angular cli latest version first and then try to serve it. – Mohit Saxena Apr 10 '19 at 12:38
  • @MohitSaxena : already tried that as well! It is reported as bug in the github angular project as Mukesh has pointed out in the comment – Krishna Chandran Apr 10 '19 at 16:34
  • FYI - Angular 7 does not support Node 11 https://v7.angular.io/guide/quickstart . Are you sure you tried using Node 10? – marianocodes Aug 28 '19 at 00:26

0 Answers0