Search code examples
node.jstowerjs

Trouble installing tower module - ws module crashes


I'm new to node.js and I have installed it by running the installation from the node website. I've had a play installing packages globally (e.g. should) but now I'm trying to install the tower module on my Mac, like so:

sudo npm install tower -g

It install a bunch of stuff and then crashes, with output

npm http 304 https://registry.npmjs.org/tinycolor
npm http 304 https://registry.npmjs.org/zeparser/0.0.5

> [email protected] install /usr/local/lib/node_modules/tower/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> node install.js

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

node.js:520
var cwd = process.cwd();
                  ^
Error: EACCES, permission denied
at Function.startup.resolveArgv0 (node.js:520:23)
at startup (node.js:54:13)
at node.js:611:3
npm ERR! [email protected] install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 11
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the ws 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 ws
npm ERR! There is likely additional logging output above.

If I read that correctly it's the ws (websockets?) module crashing.

In researching this problem a blog suggested I add the node path to my .bashrc so I have done that.

Any suggestions?


Solution

  • After much experimentation the only thing that worked for me was to enable the OSX root account, and then:

    su
    npm install -g tower
    

    sudo did not work but su did.