美文网首页ubuntu server
mac 安装nodejs环境

mac 安装nodejs环境

作者: fangqi179 | 来源:发表于2021-04-17 15:27 被阅读0次

官网下载可执行文件压缩包

wget https://nodejs.org/dist/v14.16.1/node-v14.16.1-darwin-x64.tar.gz
node-v14.16.1-darwin-x64.tar.gz

解压

tar zxf node-v14.16.1-darwin-x64.tar.gz

创建可执行文件软链接

ln -s ~/Downloads/node-v14.16.1-darwin-x64/bin/node /usr/local/bin
ln -s ~/Downloads/node-v14.16.1-darwin-x64/bin/npm /usr/local/bin
ln -s ~/Downloads/node-v14.16.1-darwin-x64/bin/npx /usr/local/bin

编辑环境变量

vi ~/.bash_profile
export PATH=$PATH:~/Downloads/node-v14.16.1-darwin-x64
source ~/.bash_profile

测试

npm --version
node --version
npx --version

更换为淘宝镜像

# https://registry.npmjs.org/
# 默认官方源国内下载较慢
npm config set registry https://registry.npm.taobao.org
npm config get registry

安装asar

npm install -g asar
ln -s /Users/fangqi/Downloads/node-v14.16.1-darwin-x64/bin/asar /usr/local/bin
asar --version

相关文章

网友评论

    本文标题:mac 安装nodejs环境

    本文链接:https://www.haomeiwen.com/subject/ououlltx.html