Jameson
Jameson

Reputation: 177

node-sass command not found when compiling

I have a problem with SASS for node.js on Mac (OS X El Capitan)

When i trying compile a scss file to css using command 'node-sass -o css sass/style.scss' I get the following error:

node-sass: command not found

What's the problem and how i can solve it?

Upvotes: 14

Views: 68401

Answers (9)

Sinc
Sinc

Reputation: 671

I tried an npm install but that didn't install the node-sass binary. I ended up having to run

yarn --cwd assets

Upvotes: 0

Yair Abad
Yair Abad

Reputation: 354

At the same folder where you have the package.json file, open terminal and type this:

npm install node-sass

If after install this dependency still failling, remove node_modules and type:

npm install

npm install will rebuild your node_modules folder with package.json dependencies updated (Previously, you install node-sass in package.json with 'npm install node-sass' command).

Upvotes: 0

vladanPro
vladanPro

Reputation: 513

This helped me:

sudo npm install --unsafe-perm -g node-sass

Upvotes: 6

hustnzj
hustnzj

Reputation: 815

try this: npx node-sass -o css sass/style.scss

npx will check whether <command> exists in $PATH, or in the local project binaries, and execute it. The more detail explanation is here

Upvotes: 12

Rishu Srivastav
Rishu Srivastav

Reputation: 21

to use sass you must have node installed and than use the following command

sudo npm install -g node-sass

this is for linux users only, if you have not used "sudo" you will get the following error

node-sass not found

Upvotes: 0

Afsina
Afsina

Reputation: 11

You may try this:

pwd

Checkout to your project directory, for eg:desktop

ls -la

Then see your project name and its position. Whether it’s in root. If its in root,

sudo chown -R <change to your position from root><projectname>/
cd <projectname>
cd ../
rm -rf node_modules/
ls
npm i

Upvotes: 0

Leonardo Pineda
Leonardo Pineda

Reputation: 1028

go to https://github.com/sass/node-sass download .zip or clone repo add el folder node-sass in node-modules and en file package-lock.json add this.

"node-sass": {
  "version": "4.7.2",
  "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.7.2.tgz",
  "integrity": "sha512-CaV+wLqZ7//Jdom5aUFCpGNoECd7BbNhjuwdsX/LkXBrHl8eb1Wjw4HvWqcFvhr5KuNgAk8i/myf/MQ1YYeroA==",
  "dev": true,
  "requires": {
    "async-foreach": "0.1.3",
    "chalk": "1.1.3",
    "cross-spawn": "3.0.1",
    "gaze": "1.1.2",
    "get-stdin": "4.0.1",
    "glob": "7.1.2",
    "in-publish": "2.0.0",
    "lodash.assign": "4.2.0",
    "lodash.clonedeep": "4.5.0",
    "lodash.mergewith": "4.6.1",
    "meow": "3.7.0",
    "mkdirp": "0.5.1",
    "nan": "2.8.0",
    "node-gyp": "3.6.2",
    "npmlog": "4.1.2",
    "request": "2.79.0",
    "sass-graph": "2.2.4",
    "stdout-stream": "1.4.0",
    "true-case-path": "1.0.2"
  },

ok now

~$ npm install

Upvotes: 0

S. Buda
S. Buda

Reputation: 767

In my case, I was getting errors like this because npm install didn't run correctly. removing my node_modules and then rerunning that command removed my build errors.

Upvotes: 3

CDT
CDT

Reputation: 10621

It means command node-sass is missing in your system. node-sass is a node.js command which can be installed with

npm install -g node-sass

The -g switch means a node.js command which can run globally is being installed. Without -g means a node.js library is being installed at current directory.

Upvotes: 15

Related Questions