安装node
2022-08-12 10:44:37
https://blog.csdn.net/ws9029/article/details/125885368
下载
wget https://sourceforge.net/projects/yarn.mirror/files/v1.22.19/yarn-v1.22.19.tar.gz/download
2.解压
tar -xvf node-v16.16.0-linux-x64.tar.xz tar -xvf yarn-v1.22.19.tar.gz ln -s /usr/local/nodejs/node-v16.16.0-linux-x64/bin/node /usr/local/bin/ ln -s /usr/local/nodejs/node-v16.16.0-linux-x64/bin/npm /usr/local/bin/ ln -s /usr/local/nodejs/yarn-v1.22.19/bin/yarn /usr/local/bin/
3. 配置环境变量
vim /etc/profile JAVA_HOME=/opt/jdk1.8.0_251 JRE_HOME=/opt/jdk1.8.0_251/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib MAVEN_HOME=/usr/local/maven/apache-maven-3.8.6 NODE_HOME=/usr/local/nodejs/node-v16.16.0-linux-x64 YARN_HOME=/usr/local/nodejs/yarn-v1.22.19 PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$MAVEN_HOME/bin:$NODE_HOME/bin:$YARN_HOME/bin PATH=/usr/local/bin:$PATH export JAVA_HOME JRE_HOME CLASS_PATH MAVEN_HOME YARN_HOME NODE_HOME PATH source /etc/profile
5. 检验是否安装成功
node -v npm -v yarn -v
6. 设置淘宝源镜像
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
npm config set registry https://registry.npm.taobao.org