Module build failed: Error: `sass-loader` requires `node-sass` >=4. Please install a compatible version

前端 未结 9 1297

Can you help me? I got this error when I hit ng s

ERROR in ./src/styles.scss (./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modul         


        
相关标签:
9条回答
  • 2021-02-19 10:03

    check for the supported version. As on date I had node 12.x installed on my machine and spent an hour running npm install node-sass and npm rebuild node-sass with --force and --save-dev hints.

    Nothing worked until I uninstalled the node 12.x and installed node 10.x. So if you're hitting the same problem and could not get it to work, try following

    • Check if your Node version (Run node -v) if it's higher than 10.x
    • Uninstall the Node 12.x from your machine
    • Download and Install Node 10.x
    • Restart the console/editor (not required for all and may work without this step)
    0 讨论(0)
  • 2021-02-19 10:15

    If you are facing this issue even after upgrading node-saas to version above 4 then follow below thread

    Sass-loader requires node-sass >=4 even if that exist

    0 讨论(0)
  • 2021-02-19 10:16

    npm rebuild --force - this will rebuild all packages. Only this worked for me

    0 讨论(0)
  • 2021-02-19 10:19

    Try rebuilding node-sass using npm rebuild node-sass and check if that fixes your issue.

    0 讨论(0)
  • 2021-02-19 10:20

    Re-installing webpack solved the issue for me.

    npm install --save-dev webpack
    

    or, you can try :

    npm rebuild node-sass
    
    0 讨论(0)
  • 2021-02-19 10:21

    working solution

    Step 1 rm -rf node_modules it removes the directory recursively (the existing node modules, takes a min or two)

    Step 2 npm install this will work for sure, i did try and it worked.

    0 讨论(0)
提交回复
热议问题