Linux

ubuntu18安装yarn、安装vue

2019-06-05  本文已影响0人  IT宝哥哥

操作系统为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()"

参考:https://blog.csdn.net/jaket5219999/article/details/81011764

第二步:安装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

参考:https://idroot.us/tutorials/install-yarn-ubuntu-18-04-lts/

第三步:给yarn换淘宝源

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

参考:https://blog.csdn.net/p358278505/article/details/72916548

第四步:安装vue

yarn global add @vue/cli

参考:https://cli.vuejs.org/guide/installation.html

如果安装完找不到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

作者:waketzheng
来源:CSDN
原文:https://blog.csdn.net/jaket5219999/article/details/87882747

上一篇下一篇

猜你喜欢

热点阅读