安装nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
执行上面的命令
如果出现问题 可能是版本不对
去github上 找最新版本https://github.com/nvm-sh/nvm
修改hosts
sudo vim /etc/hosts
199.232.96.133 raw.githubusercontent.com
重启网卡
systemctl restart NetworkManager.service
安装成功后
安装node
nvm install v16.13.0
在安装nodejs的时候特别慢,安装了好久都安装不上去,网速实在是太慢了,需要将nvm的默认下载地址改为国内的,我使用了淘宝的镜像,在.bashrc文件中追加如下内容
vim ~/.bashrc
# nvm淘宝镜像
export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
使用 16.13.0
nvm use v16.13.0
查看安装环境
nvm current
nvm list
更换默认环境
nvm alias default v16.13.0
安装yarn
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 update && sudo apt install yarn
sudo apt-get remove yarn
sudo apt-get autoremove
npm install -g cnpm --registry=https://registry.npm.taobao.org # 安装cnpm
安装vue-cli
初始化
yarn init
添加淘宝源
npm config set registry http://registry.npm.taobao.org/
# 速度不行可以考虑换源 npm
npm install -g @vue/cli
yarn add global @vue-cli
安装完毕 后 输入
yarn
常规安装
vue create vueproject
本文介绍了如何通过NVM安装和管理Node.js,包括解决安装过程中的网络问题,设置NVM的国内镜像源以提高下载速度,以及安装和配置Yarn和Vue CLI。此外,还讲解了如何切换和设置默认Node.js版本,并使用淘宝源加速npm包的安装。
2065

被折叠的 条评论
为什么被折叠?



