owenmelbz
owenmelbz

Reputation: 6584

Installing Titanium ACS

We're trying to install Titaniums ACS via command line using

sudo npm -g install acs

however it keeps failing and we get the below error

npm http GET https://registry.npmjs.org/bindings

> [email protected] install /usr/local/lib/node_modules/acs/node_modules/connect-mongo/node_modules/mongodb/node_modules/bson
> node install.js

sh: node: command not found
npm ERR! Error: ENOENT, lstat '/usr/local/lib/node_modules/acs/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/WebSocketMain.swf'
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!     <[email protected]>

npm ERR! System Darwin 12.3.0
npm ERR! command "node" "/usr/local/bin/npm" "-g" "install" "acs" "--color" "false"
npm ERR! cwd /Users/titanium
npm ERR! node -v v0.8.22
npm ERR! npm -v 1.2.14
npm ERR! path /usr/local/lib/node_modules/acs/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/WebSocketMain.swf
npm ERR! fstream_path /usr/local/lib/node_modules/acs/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/WebSocketMain.swf
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15)
npm ERR! [email protected] install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 127
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the bson 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 bson
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.3.0
npm ERR! command "node" "/usr/local/bin/npm" "-g" "install" "acs" "--color" "false"
npm ERR! cwd /Users/titanium
npm ERR! node -v v0.8.22
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/qs/0.5.1
npm http 304 https://registry.npmjs.org/pause/0.0.1
npm http 304 https://registry.npmjs.org/send/0.0.4
npm http 304 https://registry.npmjs.org/bytes/0.1.0
npm http 304 https://registry.npmjs.org/bindings

> [email protected] install /usr/local/lib/node_modules/acs/node_modules/socket.io/node_modules/redis/node_modules/hiredis
> node-gyp rebuild

/usr/local/lib/node_modules/npm/bin/node-gyp-bin/node-gyp: line 2: node: command not found
npm WARN optional dep failed, continuing [email protected]
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/titanium/npm-debug.log
npm ERR! not ok code 0
iMac:~ titanium$ node-gyp
-bash: node-gyp: command not found
iMac:~ titanium$ hiredis
-bash: hiredis: command not found
iMac:~ titanium$ apt-get install homebrew
-bash: apt-get: command not found
iMac:~ titanium$ node
> echo 1
... exit
... no
... 
> 
(^C again to quit)
> 
iMac:~ titanium$ node install.js

module.js:340
    throw err;
          ^
Error: Cannot find module '/Users/titanium/install.js'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:245:9)

However we can type node into the terminal and it runs it fine, and loads of node functionality works perfectly.

If anybody has any insights to this issue it would be very helpful.

Thank you

Upvotes: 2

Views: 2918

Answers (4)

Jack Torris
Jack Torris

Reputation: 804

Before installing the CLI, you should decide where you want the Node Package Manager (npm) to install packages. By default npm installs into /usr/local on OS X and Linux, which requires that you run npm as root. This is not recommended. You can avoid having to run npm by doing one of the following:

Make the /usr/local directory writable by all:

sudo chmod 777 /usr/local

Set npm to install to your home directory, or another directory of your choosing by setting the npm prefix. For example, you can add the following to your .bash_profile or other initialization file:

export NPM_CONFIG_PREFIX=$HOME

Alternately, you can create a .npmrc file in your home directory with the following contents:

prefix=/path/to/home

Where /path/to/home is the path to your home directory. Setting the npm prefix to your home directory causes the npm packages to be installed to $HOME/lib/node_modules and launch scripts are installed in $HOME/bin. $HOME/bin must be in your PATH.

If you change your prefix after installing npm packages, you will have to reinstall packages. If you change the permissions on /usr/local after installing packages as root, you may need to change the ownership of the npm cache folder, as described in Troubleshooting npm Problems. Troubleshooting npm Problems

If you experience an issue installing any of the npm packages, try the following:

Check permissions. If you originally ran npm using sudo, you may need to change the ownership of the npm cache folder.

sudo chown -R <username> ~/.npmrc

On Windows, the npm cache defaults to npm-cache in the user's home directory.

Clear the npm package cache:

npm cache clean

Remove your .npmrc file.

Upvotes: 0

Alberto Zaccagni
Alberto Zaccagni

Reputation: 31590

Don't use npm with root privileges, that is unsafe.

I would suggest you to give ownership to /usr/local to your user, to do so you could do

sudo chown -R $USER /usr/local

as adviced here by npm's author: http://howtonode.org/introduction-to-npm

I tried installing it without sudo and worked ok.

Upvotes: 0

Aaron Saunders
Aaron Saunders

Reputation: 33345

Did you try clearing the npm cache?

npm cache clean

Upvotes: 1

user568109
user568109

Reputation: 48013

Looks like node is not in PATH for sudo user.

Either set up node for sudo like given here or run it with sudo -E option.

Upvotes: 0

Related Questions