1

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.

Community
  • 1
  • 1
  • Since you [commented](http://stackoverflow.com/questions/25566008/trouble-when-installing-meanio-on-mac-os-x-using-npm#comment41000097_26125545) that updating npm to 2.0.0 solved the problem, would you mind marking the question as solved? Also please review the answers and mark one as chosen if it helped. – revelt Jan 20 '17 at 10:24

2 Answers2

0

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.

wilbeibi
  • 3,403
  • 4
  • 25
  • 44
  • I tried several solutions: 1. cd to Home directory (the same error persists) 2. change the permission of node related folders (sudo chmod 777) 3. sudo chown -R $USER /usr/local/ The same error persists – TheCoolestPenguin Sep 01 '14 at 05:04
0

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