error /node_modules/node-sass: Command failed error /node_modules/node-sass: Command failed vue.js vue.js

error /node_modules/node-sass: Command failed


I had the same issue upgraded the node-sass version to be the same as node version. with yarn just run:

yarn add node-sass

this will upgrade the version and fix the issue


I had the same problem and I solved with the steps:

  1. if your are on Apple M1 Chip, run terminal with Rosetta 2 (optional, only necessary if you have the Node installed with Rosetta)
  2. check your node-sass version in your package.json and compare with the following table:
NodeJSSupported node-sass versionNode Module
Node 166.0+93
Node 155.0+88
Node 144.14+83
Node 134.13+, <5.079
Node 124.12+72
Node 114.10+, <5.067
Node 104.9+, <6.064
Node 84.5.3+, <5.057
Node <8<5.0<57
  1. install the Nodejs version according with your node-sass
  2. clean old node_modules with: rm -rf node_modules
  3. run: npm install

Resource:


I am running Rails 6 and for some reason it was pulling webpacker 4.3.0 which was pulling node-sass 4.3.0 rather than 6.0.0 which is the latest as of the date of this post.

What worked for me is the following:

  1. Deleting the node_module folder, package-lock.json and yarn.lock
  2. In my package.json, I upgraded rails/webpacker: 5.3.0.
  3. I then re-ran yarn install.
  4. Then I ran yarn add node-sass

That worked like a charm, after trying everything else above.

I believe those were the exact steps, although to be honest I have been trying sooo many things and they didn't work and I finally got it to work so there is a possibility I may have missed a step, but I did my best to re-create it for any future frustrated soul out there.