安装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 # 运行测试,查看版本
参考资料
- https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
- https://yarnpkg.com/lang/en/docs/install/#debian-stable
- https://gist.github.com/52cik/c1de8926e20971f415dd
- NodeJS使用淘宝npm镜像站的各种姿势
-- EOF --
本文最后修改于7年前 (2018-06-18)