centos6.3中安裝nodejs和npm

查看我本地centos版本:

[wz@supportserver-51 ~]$ rpm -q centos-release
centos-release-6-3.el6.centos.9.x86_64
sudo wget https://nodejs.org/dist/v0.12.6/node-v0.12.6-linux-x64.tar.gz

解壓之後發現沒有./configure,估計下載錯了,然後我去下載這個:

sudo wget https://nodejs.org/dist/v0.12.6/node-v0.12.6.tar.gz

這個可以了:

tar zxvf node-v0.12.6.tar.gz
cd
./configure
make && make install

make && make install 輸出了一大堆東西,用了好幾分鐘,需要耐心等候。

node -v
v0.12.6

OK,我們進行下一步,安裝npm。

參考這裏:https://github.com/npm/npm

最後我使用的:

[wz@supportserver-51 node-v0.12.6]$ sudo curl -L https://www.npmjs.com/install.sh | sudo sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6239  100  6239    0     0   6841      0 --:--:-- --:--:-- --:--:--  9934
tar=/bin/tar
version:
tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
install npm@latest
fetching: http://registry.npmjs.org/npm/-/npm-2.12.1.tgz
-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|//usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js
npm@2.12.1 /usr/lib/node_modules/npm
It worked
[wz@supportserver-51 node-v0.12.6]$ 

在這之前你可能需要建一下軟鏈:

sudo ln -s /usr/local/bin/node /usr/bin/node

否則可能會提示你沒有安裝nodejs無法安裝npm。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章