Reputation: 47
I'm trying to install the node-sass
npm module on macOS 10.12. I installed npm fine with brew install node
(although I needed to sudo chown
some directories), and npm install -g node-sass
works fine and installs it perfectly fine. However, when I run node-sass
after that it doesn't work. It just says -bash: node-sass: command not found
. The command which npm
returns /usr/local/bin/npm
if that helps.
Installing node-sass
locally with just npm install node-sass
without the global flag (-g
), cd
-ing into ./node-modules/node-sass/bin/
and then running ./node-sass
works, but I'd like it to run globally because an Atom package I'd like to use (sass-autocompile
) requires it to run globally.
Upvotes: 0
Views: 4098
Reputation: 47
I fixed this problem and I'm posting this answer for anyone else that may have the same problem.
First, check the path prefix of npm
. You can check the path prefix with npm config get prefix
.
My path prefix was actually /usr/local/Cellar/node/6.3.0/libexec/npm
instead of /usr/local
.
Change this to /usr/local/
with npm config set prefix /usr/local
. Also use sudo chown $USER /usr/local/ && sudo chown $USER /usr/local/bin
to change ownership of those directories if your current user doesn't already own them.
Now you can run npm install -g node-sass
and after installation, it should work!
Upvotes: 1
Reputation: 302
On Mac OSX, path to 'node-sass' command is required.
Did you install the package globally (npm install -g node-sass) or locally? If locally, the CLI tool can be called as ./node_modules/.bin/node-sass
When it's installed globally, you need to have /usr/local/bin in your $PATH environment variable. Or call it with a full path: /usr/local/bin/node-sass -o ...
Upvotes: 0