简体   繁体   English

在Centos机器上安装节点7

[英]Installing node 7 on Centos machine

I am trying to install node 7 on my Centos machine because previous versions do not support the apn protocol for sending iOS notifications. 我试图在我的Centos计算机上安装节点7,因为以前的版本不支持用于发送iOS通知的apn协议。 So I tried to execute: 所以我尝试执行:

sudo yum install nodes

and both npm and node were installed but unfortunately the latter of version v6.10.0. 并且同时安装了npm和node,但不幸的是后者安装了v6.10.0版本。

sudo npm install latest

changes nothing. 什么都不会改变。 I found a post suggesting to update the rpm repository, but that changes nothing; 我找到了一条建议更新rpm信息库的帖子 ,但这没有任何改变。 I even tried to change the command to: 我什至尝试将命令更改为:

sudo curl -sL https://rpm.nodesource.com/setup_7.x | sudo -E bash -

but when I tried to install node again, still the 6.10 version came out. 但是当我尝试再次安装节点时,仍然出现了6.10版本。

How may I force npm to adopt node7 as the stable or latest version? 如何强制npm采用node7作为稳定版本或最新版本? Or what other way there exists to install node 7 instead of 6.10 for the good? 或者有什么其他方法可以很好地安装节点7而不是6.10?

Another way is to use nvm (Node Version manager). 另一种方法是使用nvm (节点版本管理器)。 First remove node and npm, then : 首先删除节点和npm,然后:

curl https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash

source ~/.nvm/nvm.sh

nvm install 7
nvm use 7

Then check version with : 然后使用以下命令检查版本:

node -v
nvm ls

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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