npm 安装

1. 下载

wget https://npm.taobao.org/mirrors/node/v10.8.0/node-v10.8.0-linux-x64.tar.gz

2. 解压

tar -zxvf node-v10.8.0-linux-x64.tar.gz

3.设置环境变量

vim /etc/profile

export PATH=$PATH:/root/node-v10.8.0-linux-x64/bin

source /etc/profile

4. 安装cnpm 

由于NMP源都在国外,下载相关资源很慢,所以建议用国内的淘宝NPM镜像(http://npm.taobao.org/)

  通过cnmp命令安装的包都会从淘宝NMP下载,速度很快。  

npm install -g cnpm --registry=https://registry.npm.taobao.org

cnpm install

cd  项目中

npm  run   build-{{项目}}

编译结果

[root@localhost hip-frontend]# ls
build  config  dist  favicon.ico  node_modules  package.json  README.md  src  static  test
原文地址:https://www.cnblogs.com/fengjian2016/p/9555656.html