Linux安装:Vue打包编译环境-node环境
- 安装软件
- 9天前
- 21热度
- 0评论
1、安装
1.1、安装依赖
yum install -y gcc gcc-c++
1.2、下载node包
去官网下载安装文件:https://nodejs.org/en/download
选择合适的版本(与操作系统的依赖匹配)
wget https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-x64.tar.xz
1.3、解压到指定目录
tar -xvf node-v14.17.0-linux-x64.tar.xz
mv node-v14.17.0-linux-x64 /opt/node14
1.4、修改环境变量
vi /etc/profile
# 在文件最后添加以下配置:
export NODE_HOME=/opt/node14
export PATH=$NODE_HOME/bin:$PATH
1.5、生效与检查
source /etc/profile
node -v
2、设置代理镜像
设置国内的代理
npm config set registry https://mirrors.cloud.tencent.com/npm/ --global
# 其他的代理镜像地址
npm 官方原始镜像网址是:https://registry.npmjs.org/
淘宝 NPM 镜像:https://registry.npm.taobao.org
阿里云 NPM 镜像:https://npm.aliyun.com
腾讯云 NPM 镜像:https://mirrors.cloud.tencent.com/npm/
华为云 NPM 镜像:https://mirrors.huaweicloud.com/repository/npm/
网易 NPM 镜像:https://mirrors.163.com/npm/
中国科学技术大学开源镜像站:http://mirrors.ustc.edu.cn/
清华大学开源镜像站:https://mirrors.tuna.tsinghua.edu.cn/
查看代理设置是否成功
npm config get registry