ChelesteWang / FE-Review

前端知识复盘与整理
Apache License 2.0
33 stars 8 forks source link

工程化杂谈 #8

Open ChelesteWang opened 3 years ago

ChelesteWang commented 3 years ago

使用 cross-env 解决 Windows Mac Linux 的环境问题

npm install cross-env -d -save

npm script 设置

cross-env NODE_ENV=dev
ChelesteWang commented 3 years ago

使用 rimraf 解决 Windows Mac Linux 的环境下删除文件

npm install  rimraf -d -save

npm script 设置

rimraf dist
ChelesteWang commented 2 years ago

使用 npm-run-all 运行多个 npm 指令

npm install  npm-run-all -d -save

npm script 设置

npm-run-all build clean
ChelesteWang commented 2 years ago

更新升级node版本的方法如下:

1)首先:查看当前node版本:

node –v

2)安装n模块:

npm install -g n

3)升级到指定版本/最新版本(该步骤可能需要花费一些时间)升级之前,可以执行n ls (查看可升级的版本) 如:n v6.9.1

或者你也可以告诉管理器,安装最新的稳定版本

n stable

或者升级到最新版

n latest

4)安装完成后,查看Node的版本,检查升级是否成功

node -v