Alex Yeung
Alex Yeung

Reputation: 2515

Node.js two versions installation

I created a SHELL service from Shellmix.

Node.js v5.8-pre was installed in the hosting machine under directory /usr/local/bin/. However I would like to install v6.6 under my $HOME directory.

I have successfully installed node.js v6.6 in my $HOME directory with

> ./configure --prefix=$HOME/
> gmake
> gmake install
> alias node $HOME/bin/node
> alias npm $HOME/bin/npm
> alias node-waf $HOME/bin/node-waf

When I try node app.js, it really using v6.6 node.js. However when I try npm, it gave me an error.

Error: npm doesn't work with node v0.5.8-pre
Required: [email protected] || 0.7 || 0.8
    at /homex/hkalex/lib/node_modules/npm/bin/npm-cli.js:60:23
    at Object.<anonymous> (/homex/hkalex/lib/node_modules/npm/bin/npm-cli.js:80:2)
    at Module._compile (module.js:432:26)
    at Object..js (module.js:450:10)
    at Module.load (module.js:351:31)
    at Function._load (module.js:310:12)
    at Array.0 (module.js:470:10)
    at EventEmitter._tickCallback (node.js:200:26)

Sorry that I am not good at Linux environment. Could any one help me to make npm work? Thanks!

Upvotes: 0

Views: 956

Answers (2)

Alex Yeung
Alex Yeung

Reputation: 2515

I did fix this problem.

I modified the first line of npm-cli.js from

#!/usr/bin/env node

to

#!/usr/bin/env /homex/hkalex/bin/node

Upvotes: 0

JP Richardson
JP Richardson

Reputation: 39395

You should really just use NVM to make your life a lot easier.

Upvotes: 2

Related Questions