5

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+

0

3 Answers 3

11

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
Sign up to request clarification or add additional context in comments.

1 Comment

In case someone's getting version incompatibility error after installation: Uninstall latest version: npm uninstall node-sass Then install desired version for ex: npm install [email protected]
6

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

npm install sass

1 Comment

Welcome to StackOverflow. You should add that the import/require statement has to change as well. Also, do you happen to know if breaking changes were introduced when they moved to the JS-only implementation? Then a link to an upgrade guide would be of immense help, too.
2

As per the error, the node-sass is not present or may be not installed properly.

You have to install using below command

npm install node-sass

or

npm install --save node-sass

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.