Trouble when installing MEANIO on Mac OS X using npm - node.js

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).

Related

Installing node module in Docker on Windows fails on symlink creation

I have a nodejs docker instance running in Windows.
I have mounted a write-enabled windows directory to the docker instance.
I am trying to install shelljs into my project but it is failing with a following error:
npm ERR! Linux 4.0.9-boot2docker
npm ERR! argv "/opt/nodejs/bin/node" "/usr/bin/npm" "install" "shelljs"
npm ERR! node v4.1.2
npm ERR! npm v2.14.4
npm ERR! path ../shelljs/bin/shjs
npm ERR! code EPROTO
npm ERR! errno -71
npm ERR! syscall symlink
npm ERR! EPROTO: protocol error, symlink '../shelljs/bin/shjs' -> '/home/app/meteor-webpack-react/node_modules/.bin/shjs'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Linux 4.0.9-boot2docker
npm ERR! argv "/opt/nodejs/bin/node" "/usr/bin/npm" "install" "shelljs"
npm ERR! node v4.1.2
npm ERR! npm v2.14.4
npm ERR! path npm-debug.log.907b6eb81436ba935104c98d206fb37c
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rename
npm ERR! ETXTBSY: text file is busy, rename 'npm-debug.log.907b6eb81436ba935104c98d206fb37c' -> 'npm-debug.log'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/app/meteor-webpack-react/npm-debug.log
Please note that I have enabled symlink creation (http://www.ahtik.com/blog/fixing-your-virtualbox-shared-folder-symlink-error/) and they can be done manually via ln -s. I am running a machine as administrator.
Any idea of why the symlinks are failing. I thought that it is because the npm cache is in the virtual machine trying to symlink to windows directory, but trying to move cache to windows directory failed as well (npm config set cache ~/.npm --global)
Have you made sure you have installed Virtualbox Extension Pack for the right version of VirtualBox? Usually that is the culprit.

I can't update electron with npm

I cannot update electron-prebuilt.
I executed sudo npm update electron-prebuilt -g many times.
But, The Permission denied Error occur every time in spite of using sudo.
Why I can't update electron successfully?
iojs3.2.0, OS X 10.10.5
The following is error log.
/usr/local/lib/node_modules/electron-prebuilt/install.js:15
throw err
^
Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/electron-prebuilt/electron-tmp-download-818-1441021602097/electron-v0.31.1-darwin-x64.zip' -> '/Users/user_name/.electron/electron-v0.31.1-darwin-x64.zip'
at Error (native)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "install" "electron-prebuilt" "-g"
npm ERR! node v3.2.0
npm ERR! npm v2.14.1
npm ERR! code ELIFECYCLE
npm ERR! electron-prebuilt#0.31.1 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron-prebuilt#0.31.1 postinstall script 'node install.js'.
npm ERR! This is most likely a problem with the electron-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /usr/local/lib/node_modules/npm-debug.log
The issue is reported at https://github.com/mafintosh/electron-prebuilt/issues/48 and a workaround seems to be to first install without the -g flag which will get the file into user folder first, and then install again with -g.
EDIT: I guess somehow the permissions are messed up and I'm doing chmod. It seems that if I chmod not only for the user myself but also for group and others it works. Maybe others could also give it a try?
I had the same problem in OS X. I fixed it deleting the ~/.electron folder

Why do i have to call npm link as administrator?

I installed some nodejs packages globally via
sudo npm install gulp -g
Now I (or another developer on the same machine) wants to use it in a project with
me#host:/my/project$ npm link gulp
It fails with
unbuild gulp#3.8.11
npm ERR! Error: EPERM, chmod '/my/projectnode_modules/gulp/bin/gulp.js'
npm ERR! { [Error: EPERM, chmod '/my/projectnode_modules/gulp/bin/gulp.js']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: '/my/projectnode_modules/gulp/bin/gulp.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.2.0-4-amd64
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "link" "gulp"
npm ERR! cwd /raid5/workspaces/jgr/aktivglueck-laravel
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! path /my/projectnode_modules/gulp/bin/gulp.js
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, chmod '/my/projectnode_modules/gulp/bin/gulp.js'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /my/projectnpm-debug.log
npm ERR! not ok code 0
With
sudo npm link gulp
everything works fine.
What I want to know is: Why does npm link need admin permissions? In my understanding I am creating a link inside my project folder where I have full permissions - so what does it do on the global system?
I believe npm link creates a symlink to the current directory in wherever your globally installed node packages are. See here.
If you don't have write rights to that path (you can check with npm config get prefix) you'll get the error you see there.
To avoid having to sudo global installs/links, you could change the ownership/rights of that directory.

"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.

npm coffescript install error

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 :)

Resources