1.首先下载npm的安装包
wget https://nodejs.org/dist/v14.15.4/node-v14.15.4-linux-x64.tar.xz
2.然后将安装包进行解压
tar -xf node-v14.15.4-linux-x64.tar.xz
3.之后将解压完的文件放置在自己设定文件下
mv node-v14.15.4-linux-x64 /usr/local/node
4.之后切换到指定目录下我们要下载js文件
[root@ghcentos ~]# cd /usr/bin
[root@ghcentos bin]# ln -s /usr/local/node/bin/node node
[root@ghcentos bin]# ln -s /usr/local/node/bin/npm npm
5.这样完成了前期准备 接下来我们就要进行下载vue.js
首先需要下载一个淘宝的镜像文件 下载完事后要切换到镜像中进行下载
[root@ghcentos bin]# npm config set registry https://registry.npm.taobao.org
[root@ghcentos bin]# npm config get registry --该字段的意思是校验是否下载成功如果不好用的话可以使用如下代码
npm install -g cnpm --registry=https://registry.npm.taobao.org
cd /usr/bin
ln -s /usr/local/node/bin/cnpm cnpm
这里是下载成功的提示
https://registry.npm.taobao.org/
6.切换成功后 可对vue进行安装
[root@ghcentos bin]# npm install vue
npm WARN saveError ENOENT: no such file or directory, open '/usr/bin/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/usr/bin/package.json'
npm WARN bin No description
npm WARN bin No repository field.
npm WARN bin No README data
npm WARN bin No license field.
+ vue@3.2.37
added 21 packages from 43 contributors in 4.74s
1 package is looking for funding
run `npm fund` for details
--安装后 我们就可以安装vue/cli
[root@ghcentos bin]# npm install -g @vue/cli
7.安装完毕后我们就可以进行使用啦,在网上自学的教程,勿喷!