我如何将npm(node.js包pipe理器)添加到PATH?

我像这样安装了node.js:

cd /usr/local/bin/ git clone --depth 1 http://github.com/joyent/node.git cd node git checkout origin/v0.4 # optional. Note that master is unstable. export JOBS=2 # optional, sets number of parallel commands. mkdir ~/local ./configure --prefix=$HOME/local/node make make install echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.profile source ~/.profile 

然后我执行这个curl http://npmjs.org/install.sh | sh curl http://npmjs.org/install.sh | sh安装npm。 我注销并重新login后,npm命令无法识别:

 [/usr/local/bin/node]# npm install now -bash: npm: command not found 

我应该添加到PATH有npm工作?

尝试这个:

 git clone https://github.com/npm/npm.git cd npm sudo make install 

该build议来自https://github.com/isaacs/npm#readme

它不像卷发那么可爱,但是起作用。

好消息:npm现在有了nodejs!

我是一个初学者〜,但我想要有所帮助。

我使用centos7,你知道百胜(一个工具可以下载和安装mirosoft Windows程序)

首先,我在wiki.centos上search关键字“node.js”,我find了这个。 https://wiki.centos.org/SpecialInterestGroup/SCLo/CollectionsList?highlight=%28node.js%29 。 现在有两个版本的nodej可以使用,我select了更高的版本。 该URL是https://www.softwarecollections.org/en/scls/rhscl/rh-nodejs4/和命令行如下:

 # Install a package with repository for your system: # On CentOS, install package centos-release-scl available in CentOS repository: $ sudo yum install centos-release-scl-rh # On RHEL, enable RHSCL repository for you system: $ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms # 2. Install the collection: $ sudo yum install rh-nodejs4 # 3. Start using software collections: $ scl enable rh-nodejs4 bash