简体   繁体   中英

angular not compiling with sass/scss

I'm new to angular and just installed it. Now i'm made new app with scss and when trying to use

ng serve

i'm getting next error

ERROR in ./src/styles.sass (./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.sass)
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:587:15)
    at Function.Module._load (internal/modules/cjs/loader.js:513:25)
    at Module.require (internal/modules/cjs/loader.js:643:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.sassLoader (C:\OpenServer2\OSPanel\domains\ng2\node_modules\sass-loader\lib\loader.js:46:72)
i 「wdm」: Failed to compile.

If I create new app with css all works fine so most of ways to re-intall angular, python, windows-build-tools and etc didn't worked. How i can handle with this?

Finally solved.

So, how to handle this:

1. use npm install --global --production windows-build-tools
2. open C:\Users\%user%\.windows-build-tools and manually install from there python27 to C:\Python27 and vs_BuildTools
3. repro step 1 for finishing installing needed tools for vs_buildtools
4. use npm install --global node-sass
5. done

idk why adding python to the path env didn't worked and have no any wish to find why, i just done what i'm done(and as googled - a lot of people have the same problem) and now it works

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM