在Ubunutu配置Nodejs环境,并安装Yarn

     0评论

文章目录[隐藏]

安装Nodejs

参考:https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

# 下载脚本并执行 curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - # 执行安装 sudo apt-get install -y nodejs

配置Nodejs的淘宝软件源:

以下命令可以将设置持久保存在配置文件中,参考:https://gist.github.com/52cik/c1de8926e20971f415dd

npm set registry https://registry.npm.taobao.org # 注册模块镜像 npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像

安装Yarn

参考:https://yarnpkg.com/lang/en/docs/install/#debian-stable

添加软件源

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

安装

sudo apt-get update && sudo apt-get install yarn yarn -v # 运行测试,查看版本

参考资料

-- EOF --

本文最后修改于6年前 (2018-06-18)

差评不太行一般挺好非常不错 (No Ratings Yet)
读取中...
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址