npm coffescript install error - node.js

I keep having errors when trying to install coffeescript.
node version v0.6.1
npm version 1.0.106
npm ERR! Could not create /usr/local/lib/node_modules/___coffee-script.npm
npm ERR! error installing coffee-script#1.1.3 Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR!
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "coffee-script"
npm ERR! cwd /Users/Thomas
npm ERR! node -v v0.6.1
npm ERR! npm -v 1.0.106
npm ERR! path /usr/local/lib/node_modules/___coffee-script.npm
npm ERR! code EACCES
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Thomas/npm-debug.log
npm not ok
The permission is denied and I have found that you should not sudo.
Please help and thanks in advance.
OKay all solved with the help of sudo but if anyone has any idea how to change my /usr/local/lib permissions it would be appriciated

What I do is:
sudo chown -R $USER /usr/local
That way, you can install whatever you want in /usr/local without sudoing :)

Related

npm install ember-cli fails on ubuntu trusty in vagrant virtualbox

I have not been able to successfully install ember-cli. I finally was able to run:
sudo npm install -g ember-cli
But when running:
user#host:~ ember new ember-app
I get:
/usr/bin/env: node: No such file or directory
I installed node.js from the repositories using sudo apt-get install nodejs and same with npm.
I have installed bower and tried to re-install npm. Here is the last error:
user#host:~ npm install -g ember-cli
npm http GET https://registry.npmjs.org/ember-cli
npm http 200 https://registry.npmjs.org/ember-cli
npm http GET https://registry.npmjs.org/ember-cli/-/ember-cli-0.2.7.tgz
npm http 200 https://registry.npmjs.org/ember-cli/-/ember-cli-0.2.7.tgz
npm ERR! Error: shasum check failed for /home/user/tmp/npm-14461-xfhNCJKF/1435776262780-0.6301117099355906/tmp.tgz
npm ERR! Expected: fefcd9fe7faf276a5a68c8bfcc92288c0f0678d5
npm ERR! Actual: c120ca4196f11da6e51f9c8ebb273439dcfee615
npm ERR! at /usr/lib/nodejs/sha/index.js:38:8
npm ERR! at ReadStream.<anonymous> (/usr/lib/nodejs/sha/index.js:85:7)
npm ERR! at ReadStream.EventEmitter.emit (events.js:117:20)
npm ERR! at _stream_readable.js:920:16
npm ERR! at process._tickCallback (node.js:415:13)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.13.0-55-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "ember-cli"
npm ERR! cwd /home/user
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/user/npm-debug.log
npm ERR! not ok code 0
For clarity, I am able to install other items using npm. Just not ember-cli.
UPDATE:
I am getting similar errors that I've received in previous executions of npm install -g ember-cli when run the following:
npm install -g latest-version
Received the following error:
npm http GET https://registry.npmjs.org/latest-version
npm http 304 https://registry.npmjs.org/latest-version
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/latest-version'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/latest-version']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/latest-version',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/latest-version',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/lib/nodejs/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/lib/nodejs/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.13.0-55-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "--global" "latest-version"
npm ERR! cwd /home/user
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /usr/local/lib/node_modules/latest-version
npm ERR! fstream_path /usr/local/lib/node_modules/latest-version
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/latest-version'
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/nodejs/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/user/npm-debug.log
npm ERR! not ok code 0
-
UPDATE:
"Fix" is in the comment below.
For your node issue, try the following command which will make it so your system recognizes your node.js directory as node:
sudo ln -s /usr/bin/nodejs /usr/bin/node
Regarding the issue with administrator access, simply run your commands with sudo at the beginning. Sudo is usually required in situations where modifications to the filesystem are necessary.

Trouble when installing MEANIO on Mac OS X using npm

When I try to install MEANIO on my Mac using npm, I encountered several errors which failed the installation. The errors are shown below:
There are two major types of problem: one is Error EACCES, and the other one is ERROR ENOENT. I have attempted several solutions, which don't really help much.
1. sudo npm clear cache
2. sudo npm update -g
3. Permission fix: by changing nodejs folder's permission to local user
(refer to: npm install errors with Error: ENOENT, chmod)
I wonder what is causing the problem. Since I am not publishing my own app, there is no way to include .npmignore according to the solution provided in the link. The second answer in the link claims that the nature of the problem is:
"Above action caused some dependencies being installed inside ~/.npm/ dir, having root:root ownership (because of sudo ...). Evidently npm does not run as local user (or change dependencies subdirs ownership afterwards) when pulling dependencies and writing them to a local user subdir ~/.npm/. As long as npm would be so careless against fundamental unix filesystem security issues the problem would reoccur."
I doubt if this is the correct in my case. The installation of MEANIO shouldn't be causing so many problems.
The shell commands and error messages are shown below:
localhost:local Nick_Guan$ sudo npm install -g meanio#latest
npm WARN engine meanio#0.6.6: wanted: {"node":"0.10.x","npm":"1.4.x"} (current: {"node":"0.10.31","npm":"2.0.0-beta.1"})
npm WARN engine npm#1.5.0-alpha-4: wanted: {"node":">=0.8","npm":"1"} (current: {"node":"0.10.31","npm":"2.0.0-beta.1"})
> mean-health#0.1.5 postinstall /usr/local/lib/node_modules/meanio/node_modules/mean-health
> node postinstall
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
node.js:815
var cwd = process.cwd();
^
Error: EACCES, permission denied
at Function.startup.resolveArgv0 (node.js:815:23)
at startup (node.js:58:13)
at node.js:906:3
npm ERR! Error: ENOENT, chown '/usr/local/lib/node_modules/meanio/node_modules/prompt/test/prompt-test.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "meanio#latest"
npm ERR! cwd /usr/local
npm ERR! node -v v0.10.31
npm ERR! npm -v 2.0.0-beta.1
npm ERR! path /usr/local/lib/node_modules/meanio/node_modules/prompt/test/prompt-test.js
npm ERR! fstream_path /usr/local/lib/node_modules/meanio/node_modules/prompt/test/prompt-test.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chown
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:308:19
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:143:7
npm ERR! fstream_stack Object.oncomplete (evalmachine.<anonymous>:107:15)
npm ERR! Error: ENOENT, chmod '/usr/local/lib/node_modules/meanio/node_modules/npm/bin/npm-cli.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "meanio#latest"
npm ERR! cwd /usr/local
npm ERR! node -v v0.10.31
npm ERR! npm -v 2.0.0-beta.1
npm ERR! path /usr/local/lib/node_modules/meanio/node_modules/npm/bin/npm-cli.js
npm ERR! fstream_path /usr/local/lib/node_modules/meanio/node_modules/npm/bin/npm-cli.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:308:19
npm ERR! fstream_stack Object.oncomplete (evalmachine.<anonymous>:107:15)
npm ERR! Error: ENOENT, chown '/usr/local/lib/node_modules/meanio/node_modules/bower/lib/config.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "meanio#latest"
Any help would be appreciated.
double check whether prerequisite is installed rightly, make sure execute the install command in somewhere under your home directory.
Check here: https://groups.google.com/forum/#!topic/gnu.bash.bug/JkcxWDfilZI
You're in a directory which can be read and
searched only by root, and you're su'ing to another user. That user
does not have permission to search the current directory, even to find
`..', so getcwd is going to fail.
I had a similar problem and found the permission issue was on the base npm directory in my root user directory /User/tomk/.npm in my case. The subdirectory for npm was owned by root (probably from having to sudo to install node/npm). Once I changed the ownership to my account, meanio installed without the fatal errors (lots of warnings, but nothing to stop the install).

NPM installation issues on Mac OS Mavericks

I am trying to get to grips with AngularJS, NodeJS and Ruby on Rails. When trying to install npm packages like yeoman, grunt etc. I receive an error in my Terminal which I have listed below:
npm ERR! Error: EACCES, open '/Users/Jabane/.npm/glob/3.2.11/package/package.json.25961'
npm ERR! { [Error: EACCES, open '/Users/Jabane/.npm/glob/3.2.11/package/package.json.25961']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/Jabane/.npm/glob/3.2.11/package/package.json.25961',
npm ERR! parent: 'browserify' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "browserify"
npm ERR! cwd /Users/Jabane
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.16
npm ERR! path /Users/Jabane/.npm/glob/3.2.11/package/package.json.25961
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Users/Jabane/.npm/glob/3.2.11/package/package.json.25961'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/kJabane/npm-debug.log
npm ERR! not ok code 0
What might be the issue in this case? Your assistance is highly appreciated.
Thanks
This is a permissions issue. You need to prefix your npm install command with sudo, e.g.:
sudo npm install yeoman
It will prompt you for your User Account's password; and subject to the correct password being provided, will then install the packages correctly.

"sudo npm install -g grunt-cli" gives me an error

I get an error when trying to install gruntjs on a linux 12.04 (with a mirrored packages source)
Here is the error:
sudo npm install -g grunt-cli
npm ERR! Error: ENOENT, open '/home/havetl/.npm/d63f3d0b-grunt-cli.lock'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /home/havetl
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path /home/havetl/.npm/d63f3d0b-grunt-cli.lock
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR! { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /home/havetl
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/havetl/npm-debug.log
npm ERR! not ok code 0
Thanks for any idea!
According to the maintainer of npm, installing packages with sudo is considered bad practice because you are allowing that package to have complete control of your system and you can't and SHOULDN'T trust these packages with root access. Think Debian's long release cycles as an extreme example of protecting end users from community maintained packages for this exact reason.
http://howtonode.org/introduction-to-npm
You should do what Issaacs suggests and chown your /usr/local folder so you have RW permissions.
I've had this problem before; sometimes for global packages your current working directory has to be ~/ (but I'm not sure why this is!). Try:
cd ~/; sudo npm install -g grunt-cli
This blog worked for me :
http://slopjong.de/2012/10/31/how-to-install-the-latest-nodejs-in-ubuntu/
the error was because in ubuntu v12 few of the dependencies were not available for the latest version of Node.

CoffeeScript Installing with NPM and Node [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
error installing coffeescript on mac 10.7.2
At the moment, I am trying to install CoffeeScript on my computer. I have node.js version 0.6.7 and npm 1.1.0-beta-10. When i run the command npm install -g coffee-script, it shows this error.
npm http GET https://registry.npmjs.org/coffee-script
npm http 200 https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/coffee-script/-/coffee-script-1.2.0.tgz
npm http 200 https://registry.npmjs.org/coffee-script/-/coffee-script-1.2.0.tgz
npm ERR! Could not create /usr/local/lib/node_modules/___coffee-script.npm
npm ERR! error installing coffee-script#1.2.0
npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR!
npm ERR! System Darwin 11.0.1
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "coffee-script"
npm ERR! cwd /Users/Solomon
npm ERR! node -v v0.6.7
npm ERR! npm -v 1.1.0-beta-10
npm ERR! path /usr/local/lib/node_modules/___coffee-script.npm
npm ERR! code EACCES
npm ERR! message EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Solomon/npm-debug.log
How do I fix this?
Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
That means you dont have access, so run as root
$ sudo npm install -g coffee-script
(Bonus points for alternatively, not using coffeescript (it's a horrible thing))
The permission denied part is your hint that the installer needs privileges that it doesn't have. Try running as root, i.e.
sudo npm install coffee-script

Resources