So I installed Node.js by downloading the mac 0Sx package from their website, but now every time I try to run a command such as f$ grunt-cli -v I get the following error below. This path /usr/local/bin/npm also doesn't exist on my computer, and I don't know how to find node.js to unistall it, and then re-install it using homebrew. Let me know if I have left any info out.
-bash: grunt-cli: command not found
Sams-MacBook-Pro:~ SamDavidoff$ npm install -g grunt-cli
npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "grunt-cli"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! path /usr/local/lib/node_modules/grunt-cli
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, rmdir '/usr/local/lib/node_modules/grunt-cli'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, rmdir '/usr/local/lib/node_modules/grunt-cli']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/grunt-cli' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, rmdir '/usr/local/lib/node_modules/grunt-cli'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EACCES, rmdir '/usr/local/lib/node_modules/grunt-cli']
npm ERR! error rolling back errno: -13,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/grunt-cli' }
npm ERR! Please include the following file with any support request:
npm ERR! /Users/SamDavidoff/npm-debug.log
EACCES means you don't have root access. Reinstalling node/npm won't help. Like it says, try running it as admin:
sudo npm install -g grunt-cli
Or if you don't want to use sudo, install nvm (note nvm may not allow you to globally install on mac, but it does on ubuntu so it might work):
$ git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
$ ...
$ ~/.nvm/nvm.sh
$ ...
$ nvm install stable
$ ...
$ nvm use stable
$ npm install -g grunt-cli
Related
I'm following facebook's tutorial on getting started with React Native (https://facebook.github.io/react-native/docs/tutorial.html#hello-world), but I can't get the react-native-cli to install. Any help interpreting the error messages? Obviously it says to unlink something, but I don't know what it is linked to that it shouldn't be linked to.
Running as root seems to do something, but zsh still won't recognize the react-native command.
➜ ~ npm install -g react-native-cli
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "react-native-cli"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! path /Users/bbarclay/.node/bin/react-native
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, unlink '/Users/bbarclay/.node/bin/react-native'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, unlink '/Users/bbarclay/.node/bin/react-native']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/bbarclay/.node/bin/react-native' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, unlink '/Users/bbarclay/.node /bin/react-native'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EACCES, unlink '/Users/bbarclay/.node/bin/react-native']
npm ERR! error rolling back errno: -13,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/Users/bbarclay/.node/bin/react-native' }
npm ERR! Please include the following file with any support request:
npm ERR! /Users/bbarclay/npm-debug.log
➜ ~ sudo npm install -g react-native-cli
Password:
/Users/bbarclay/.node/bin/react-native -> /Users/bbarclay/.node/lib/node_modules/react-native-cli/index.js
react-native-cli#0.1.4 /Users/bbarclay/.node/lib/node_modules/react-native-cli
└── prompt#0.2.14 (revalidator#0.1.8, pkginfo#0.3.0, read#1.0.6, winston#0.8.3, utile#0.2.1)
➜ ~ react-native init AwesomeProject
zsh: command not found: react-native
Add the admin permission to .npm home directory.
sudo chown -R $(whoami) ~/.npm
I'm using nvm running node version 0.12.2.
I try and install bower globally:
karl#karl-laptop:~/www/busarama/src$ npm install -g bower
npm ERR! tar.unpack untar error /home/karl/.npm/bower/1.4.1/package.tgz
npm ERR! Linux 3.16.0-36-generic
npm ERR! argv "/home/karl/.nvm/versions/node/v0.12.2/bin/node" "/home/karl/.nvm/versions/node/v0.12.2/bin/npm" "install" "-g" "bower"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/home/karl/.nvm/versions/node/v0.12.2/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23',
npm ERR! '/home/karl/.nvm/versions/node/v0.12.2/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'FSReqWrap.oncomplete (fs.js:95:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/karl/www/busarama/src/npm-debug.log
I am very suspicious it is due to me running this earlier today:
npm config set prefix /usr/local
Does anyone know what the default npm config prefix should be (when installing -g to the local profile, not sudo)? I installed nvm as a local user.
This is affecting everything I try to install globally.
Found this little nice link: https://docs.npmjs.com/files/folders
Local install (default): puts stuff in ./node_modules of the current package root.
Global install (with -g): puts stuff in /usr/local or wherever node is installed.
Install it locally if you're going to require() it.
Install it globally if you're going to run it on the command line.
If you need both, then install it in both places, or use npm link.
...or wherever node is installed.
This means I'm guessing that it should be installed to /home/karl/.nvm/versions/node/v0.12.2 somewhere.
I need to set the npm config prefix to whatever node is running.
I just reinstalled nvm. Seemed to fix the config file.
I man on Mac OSX and want to perform a npm update to update all globally installed stuff.
After executing npm update -g, I got a lot of erros and npm is gone, like this:
localhost:~ myname$ npm
-bash: npm: command not found
I Googled but don't remember how I installed node. It seems it's not installed via brew, so that I can't use brew to un/reinstall node/npm.
-- UPDATE --
After checking the comments on some other links I decide to just reinstall node and my npm is back. But when I try to use npm install -g npm to update again, the issue returns. Here is the full stuff from my terminal:
localhost:~ myname$ npm install -g npm
npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "npm"
npm ERR! node v0.12.1
npm ERR! npm v2.5.1
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! error rolling back errno: -13,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/npm' }
npm ERR! Please include the following file with any support request:
npm ERR! /Users/myname/npm-debug.log
localhost:~ myname$ npm
-bash: /usr/local/bin/npm: No such file or directory
What should I do?
Thanks!
The error says literally: Please try running this command again as root/Administrator. It means you need to update/install with administrator privileges. To do so use "sudo":
sudo npm update -g
I apologize as i am still in the process of learning how to use ubuntu.
First i installed npm, then i installed git.
then i tried to clone a repo from git.
Then i typed the following into terminal "bower install bootstrap".
I already had the source of bootstrap downloaded in a zip file.
I received the following error:-
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/bin/bower'
npm ERR! error rolling back bower#1.3.8 { [Error: EACCES, unlink '/usr/local/bin/bower'] errno: 3, code: 'EACCES', path: '/usr/local/bin/bower' }
npm ERR! Error: EACCES, unlink '/usr/local/bin/bower'
npm ERR! { [Error: EACCES, unlink '/usr/local/bin/bower'] errno: 3, code: 'EACCES', path: '/usr/local/bin/bower' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.13.0-32-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! cwd /home/haaggis
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /usr/local/bin/bower
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/bin/bower'
npm ERR!
npm ERR! Additional logging details can be found in:
What am i doing wrong ?
Typing "npm install -g bower" into the terminal produces the above error.
And this stops me from entering "bower install bootstrap"
Please try running this command again as root/Administrator.
So, what happened when you tried sudo npm install -g bower ?
I've got problems trying to install NPM.
Always worked well, but now, i've to install "ionic" and the problem is that when i tried to re-install nodejs all work well, it seems that npm installed but trying to update it, it gives me errors, so i tried to update it via this command:
curl https://www.npmjs.org/install.sh | sh
I cannot install ionic, i don't know why. I've installed months ago cordova and phonegap, but ionic gives me trouble.
Reading guides, tell me to update my npm and doing this, that what i've (this is the following error using the command above)
cleanup prefix=/usr/local
All clean!
unbuild npm#1.4.14
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.2.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/cli.js" "rm" "npm" "-gf"
npm ERR! cwd /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.16
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/npm-debug.log
npm ERR! not ok code 0
> npm#1.4.16 prepublish .
> node bin/npm-cli.js prune --prefix=. --no-global && rm -rf test/*/*/node_modules && make -j32 doc
make: Nothing to be done for `doc'.
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back npm#1.4.16 { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! error rolling back errno: 3,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/npm' }
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.2.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/cli.js" "install" "-gf"
npm ERR! cwd /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.16
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/npm-debug.log
npm ERR! not ok code 0
Solved using the command sudo su on my mac os x (so without using sudo with the commando or sudo $username).
then using the curl commando it run.
Thanks however.
Might this answer could be usefull
Try this:
rm -rf /usr/local/lib/node_modules/npm
sudo curl https://www.npmjs.org/install.sh | sh