Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR in ./src/styles.scss .. Module build failed: Error: Cannot find module 'node-sass'

When I try to execute npm start in a new machine I have the following error:

    Time: 18322ms
chunk {main} main.js, main.js.map (main) 487 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 227 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 430 kB  [rendered]
chunk {styles} styles.js, styles.js.map (styles) 282 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 6.32 MB [initial] [rendered]

ERROR in ./src/styles.scss (./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/styles.scss)
Module build failed: Error: Cannot find module 'node-sass'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.sassLoader (C:\...(path)...\node_modules\sass-loader\lib\loader.js:24:22)
i 「wdm」: Failed to compile.

my Angular.json

...
 "styles": [
              "node_modules/bootstrap/dist/css/bootstrap.css",
              "node_modules/font-awesome/css/font-awesome.css",
              "node_modules/animate.css/animate.min.css",
              "src/styles.scss",
              "node_modules/ngx-toastr/toastr.css",
              "node_modules/alertify.js/dist/css/alertify.css"
            ],
...

My node version: v8.11.3 angular 5+

like image 751
Adriano Frota Avatar asked Dec 06 '22 11:12

Adriano Frota


2 Answers

As the error says Error: Cannot find module 'node-sass'. To solve this you have to install node-sass using following command:

npm install node-sass
like image 83
Sookie Singh Avatar answered Dec 08 '22 01:12

Sookie Singh


The node-sass library is deprecated. Use sass instead:

npm install sass
like image 22
bgeffrault Avatar answered Dec 08 '22 00:12

bgeffrault