ubuntu18安装yarn、安装vue

ubuntu18安装yarn、安装vueUpdated 2022 03 04 The acticle is out of date try this instead yarn 安装和配置国内源 jaket 的博客 CSDN 博客 yarn 配置国内 Updated at 2020 03 11 sudo apt update sudo apt install

Updated@2022-03-04

The acticle is out of date, try this instead:

yarn安装和配置国内源_jaket5219999的博客-CSDN博客_yarn配置国内

———————————————————————————————-

Updated at 2020-03-11

sudo apt update
sudo apt install nodejs
sudo apt install npm
sudo npm i -g npm --registry https://registry.npm.taobao.org
sudo npm i -g yarn --registry https://registry.npm.taobao.org
yarn config set registry https://registry.npm.taobao.org -g
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
npm config set registry https://registry.npm.taobao.org

—————————— Before updated

操作系统为ubuntu18

第一步:换源

sudo python -c "s='mirrors.163.com';import re;f=open('/etc/apt/sources.list','r+');a=f.read();f.seek(0);f.truncate();f.write(re.sub(r'(deb|security)\.debian\.org', s, a));f.close()"

参考:ubuntu 换源_jaket5219999的博客-CSDN博客

第二步:安装yarn

sudo apt-get update
sudo apt-get upgrade
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
# 如果用的是nvm,要这样安装:
# sudo apt install --no-install-recommends yarn
yarn --version

参考:How To Install Yarn on Ubuntu 18.04 LTS – idroot

第三步:给yarn换淘宝源

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

参考:yarn设置淘宝镜像问题 亲测成功_菜菜程序员-CSDN博客_yarn配置镜像仓库

第四步:安装vue

yarn global add @vue/cli

参考:Installation | Vue CLI

——————————————————————————

如果安装完找不到vue,可用find命令找到vue所在目录,把该目录加给PATH

sudo find / -name "vue"
# /home/vagrant/.yarn/bin/vue
echo '# set PATH for yarn
if [ -d "$HOME/.yarn/bin" ] ; then
PATH="$HOME/.yarn/bin:$PATH"
fi' >> ~/.profile
. ~/.profile
vue --version
# 3.4.1
编程小号
上一篇 2025-02-16 14:51
下一篇 2025-09-05 21:11

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/hz/140180.html