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 > firstname.lastname@example.org 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! email@example.com install: `node install.js` npm ERR! Exit status 8 npm ERR! npm ERR! Failed at the firstname.lastname@example.org 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 > email@example.com 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:
- Fixed permissions on my hard drive via disk utility, issues were found and fixed
- rebooted into recovery and repaired my disk, which also had issues
- 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.