4

Mac 安装node.js、vue-cli

 3 years ago
source link: https://segmentfault.com/a/1190000040434937
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

安装node

使用Homebrew安装

# 查看node.js版本/本地是否安装node.js
node -v

# 指向homebrew安装node的目录
brew link node

# 卸载node.js
brew uninstall node

# 安装node.js
brew install node

where node

https://nodejs.org/zh-cn/down...

npm镜像源设置为淘宝镜像

npm全称Node Package Manager,是node.js的模块依赖管理工具。由于npm的源在国外,所以国内用户使用起来各种不方便。

npm config set registry https://registry.npm.taobao.org

# 配置后可通过下面方式来验证是否成功
npm config get registry
# 或
npm info express

安装vue-cli

# 卸载旧版本vue-cli
npm uninstall vue-cli -g

# 安装
sudo npm install -g @vue/cli

# 查看是否安装成功
vue -V

n - node版本管理工具

# 安装
npm install -g n

# 查看node所有版本
npm view node versions

# 查看当前安装的node.js版本
n

# 使用或安装最新的官方发布:
n latest

# 使用或安装稳定的官方发布:
n stable

# 使用或安装最新的LTS官方版本:
n lts

# 安装/激活版本
# 只需执行n <version>即可安装node
# 如果已经安装,表示激活该版本。
n 0.8.14
n 6.9.1

# 删除版本,删除一些版本:
n rm 0.9.4 v0.10.0

# 或者,您可以使用以下 - 代替rm:
n - 0.9.4

# 相关用法
n --help

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK