ubuntu18安装yarn、安装vue

ubuntu18安装yarn、安装vue操作系统为ubuntu18第一步:换源sudopython-c"s=’mirrors.163.com’;importre;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.clo…

大家好,又见面了,我是你们的朋友全栈君。

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/141495.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号