简体   繁体   中英

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: node@0.6 || 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!

你应该真的只使用NVM让你的生活更轻松。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM