Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CentOS7服务器NodeJS安装 #7

Open
solocao opened this issue May 16, 2018 · 0 comments
Open

CentOS7服务器NodeJS安装 #7

solocao opened this issue May 16, 2018 · 0 comments

Comments

@solocao
Copy link
Owner

solocao commented May 16, 2018

安装步骤

1. 安装git

yum install git -y  

注:安装git是用来自动执行下载到本地的shell脚本,即下面要下载的nvm安装脚本。

2. 安装nvm服务,这个是用来管理node版本的工具,可以在服务器上切换不同的node环境

打开github找到nvm:

https://github.com/creationix/nvm

两种安装方式任选一种:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash  

或:

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash  

注:安装nvm后如果是使用xshell等工具连接服务器,则需要重新连接一次,不然会提示没有nvm

3. 使用nvm进行安装nodejs

nvm install v10.1.0

注:版本可以自己选择,我为了方便选择的是我本地的版本

4. 如果没有自动启用当前下载的版本,使用下面命令

nvm use v10.1.0

5. 当然如果要是没有自动配置成默认的node版本的话,执行下面命令

nvm alias default v8.2.1  

6. 可选: 使用淘宝源安装最新的npm

npm --registry=https://registry.npm.taobao.org install -g npm 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant