问题
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://imgur.com/a/1iKNcw0
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 :
- Without Issue
- System with Issue
Edit 3
The Angular version details is provided below
来源:https://stackoverflow.com/questions/55611062/issue-with-running-angular-7-projects