3

This isn't an error I can reproduce on all macs, was able to run this no problem on a second laptop yesterday, and is an error I get from multiple locations attempting to do multiple tasks that are all failing

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied

I first noticed this when trying to install phantomjs via npm:

$ sudo npm install -g phantomjs
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs

> phantomjs@1.9.10 install /usr/local/lib/node_modules/phantomjs
> node install.js

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! Darwin 13.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "phantomjs"
npm ERR! node v0.10.32
npm ERR! npm  v2.0.0
npm ERR! code ELIFECYCLE
npm ERR! phantomjs@1.9.10 install: `node install.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the phantomjs@1.9.10 install script.
npm ERR! This is most likely a problem with the phantomjs 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 phantomjs
npm ERR! There is likely additional logging output above.

A similar issue also occurs when installing selenium-standalone package from node.js:

$ sudo npm install -g selenium-standalone
/usr/local/bin/start-selenium -> /usr/local/lib/node_modules/selenium-standalone/bin/start-selenium

> selenium-standalone@2.43.1-2.9.0-1 install /usr/local/lib/node_modules/selenium-standalone
> node install.js

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

Which seems to indicate it's not related to any specific node.js package, however other packages install fine(such as grunt-cli)

Finally in searching for answers to this, I've also found a few things which had problems but weren't able to solve the problem in question:

  1. Fixed permissions on my hard drive via disk utility, issues were found and fixed
  2. rebooted into recovery and repaired my disk, which also had issues
  3. sudo /usr/libexec/locate.updatedb had the same issue. people recommended enabling root, and running it. This allowed that command to run correctly, and subsequent runs did not have the same error anymore. However trying this same process with npm did not lead help

I'm not sure what else could be causing the problem.

2

After further searching, I ended up finding a working answer here. I needed the --unsafe-perm flag with npm install, which allowed the packages that weren't working to be installed correctly

0

Ran into the same problem.

/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova
/usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic

> node-sass@3.4.2 install /usr/local/lib/node_modules/ionic/node_modules/node-sass
> node scripts/install.js

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
path.js:424
    var path = (i >= 0) ? arguments[i] : process.cwd();
                                                 ^

Error: EACCES: permission denied, uv_cwd
    at Error (native)
    at Object.posix.resolve (path.js:424:50)
    at startup (node.js:96:32)
    at node.js:968:3
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
npm ERR! node v4.4.3
npm ERR! npm  v2.15.1
npm ERR! code ELIFECYCLE

npm ERR! node-sass@3.4.2 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@3.4.2 install script 'node scripts/install.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.

Using the command:

sudo npm install --unsafe-perm -g cordova ionic

worked for me.

1
  • 1
    Please don't add "thanks" as answers. Invest some time in the site and you will gain sufficient privileges to upvote answers you like, which is the Super User way of saying thank you. – DavidPostill Apr 16 '16 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.