centos 6.5安裝node npm並升級npm 到指定版本

centos 6.5下面進行node的安裝node

http://uppower.blog.51cto.com/1759096/1728700react

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpmnpm

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpmcentos

rpm -ivh epel-release-6-8.noarch.rpmapp

rpm -ivh remi-release-6.rpmurl

完成後檢查是否安裝成功 ls -1 /etc/yum.repos.d/epel* /etc/yum.repos.d/remi.repo.net

成功則返回以下列表:blog

/etc/yum.repos.d/epel.repo
/etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/remi.reporem

開啓 remi 軟件倉庫 1 vi /etc/yum.repos.d/remi.repoget

編輯[remi]下的enabled選項從0設爲1 [remi]
... enabled=1 ... OK,如今可使用了。

若是運行yum 時,出現以下報錯: Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again 解決辦法: vi /etc/yum.repos.d/epel.repo 編輯[epel]下的baseurl前的#號去掉,mirrorlist前添加#號。正確配置以下: [epel]
name=Extra Packages for Enterprise Linux 6 – $basearch baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch ... 再運行 yum makecache

再次檢查epel是否已經安裝 1 yum repolist 返回軟件倉庫列表以下: repo id repo name status 10gen 10gen Repository 274 base CentOS-6 - Base 6,575 epel Extra Packages for Enterprise Linux 6 - x86_64 11,836 extras CentOS-6 - Extras 48 remi Remi's RPM repository for Enterprise Linux 6 - x86_64 3,097 remi-safe Safe Remi's RPM repository for Enterprise Linux 6 - x86_64 534 rpmforge RHEL 6 - RPMforge.net - dag 4,718 updates CentOS-6 - Updates 958 repolist: 28,040 若是返回列表中包含 epel ,則說明你已成功安裝。

最後,進行nodejs 和 npm 的安裝: 1 yum install nodejs npm --enablerepo=epel

npm install -g n
n 0.8.11 (指定版本)

npm install cnpm -g --registry=https://registry.npm.taobao.org

npm install -g create-react-app

create-react-app my-app

相關文章
相關標籤/搜索