Why can't i npm install nodemon or supervisor on OSX 10.8.4?
Late to the party, but it is important to note that you should avoid using sudo
when npm installing. It is a huge security risk to sudo npm install
as you are giving arbitrary scripts root access to your machine.
Instead you should make yourself the owner of the directories in which the NPM
sudo chown -R $USER /usr/local
and then
sudo chown -R $USER ~/.npm
Now you should be able to run the commands without sudo:
npm install supervisor -g --save
You're encountering an EACCES
error, which means you don't have the rights to create a directory in /usr/local/lib/node_modules/nodemon
as a standard user in Mac OS X.
There are two solutions:
- Run the same command as a superuser, using
sudo
. The package will be installed in/usr/local/lib/node_modules
. - Change npm's settings to install all of your global packages into one of your private folders, that your user has ownership of. See this relevant answer that explains step-by-step the process.
I know I'm late to the question, but you should check out nvm (node's answer to rbenv or virtualenv).
Install:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
Then add . ~/.nvm/nvm.sh
to your ~/.bashrc
, ~/.profile
, or ~/.zshrc
Usage:
If you wanted to use version 0.10, run nvm install 0.12.7
(or nvm install stable
), then nvm use 0.12.7
.
Install your libs, EACCESS error-free, and go to town. npm install -g supervisor
works just fine!
To load a specific version default in new tabs, use the command
nvm alias default 0.12.7