React-Native环境配置之安装Node.js

来源:互联网 发布:剑三同人知乎 编辑:程序博客网 时间:2024/05/19 02:27

一、安装NVM

nvm的作用:nvm是Node的管理器,用来安装Node.js.

 安装步骤:1.使用命令行brew install curl或者brew install wget来确保已经安装curl或者wget。

                   2.安装方式有两种①使用curl方式安装

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
                                               ②使用wget安装
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
我是采用第一种安装方式安装的,截图如下,请注意红框中的路径一会儿要使用哦


3.在.bash_profile配置一下环境变量使用命令sudo vi ~/.bash_profile 打开该文件,

<strong><span style="font-size:18px;"><strong><span style="font-size:18px;">加入如下信息</span></strong> </span></strong>export NVM_DIR="上面图片中红框的路径"<strong><span style="font-size:18px;"></span></strong>[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  #This loads nvm
然后重新打开命令行输入 nvm --version 检验是否安装成功

我的已经安装成功,版本为0.31.0
二、使用nvm安装Node.js

在终端使用如下命令

nvm install node && nvm alias default node

如图node.js 安装成功

0 0
原创粉丝点击