安装npm-check-updates
npm install -g npm-check-updates
查询是否后最新版本
在package.json所在的目录中,打开cmd,注意打开的是cmd,git-bash可能无效,输入:
npm-check-updates
或者使用该命令的简写:
ncu
如果有新版本的话,显示效果如下
Checking /Users/CooFree/Desktop/米家/miot-plugin-sdk/projects/com.xiaomi.demo/package.json
[====================] 1/1 100%
react-native-root-toast ^3.2.0 → ^3.2.1
Run ncu -u to upgrade package.json
更新依赖配置文件
ncu -u
YF:com.xiaomi.demo CooFree$ ncu -u
Upgrading /Users/CooFree/Desktop/米家/miot-plugin-sdk/projects/com.xiaomi.demo/package.json
[====================] 1/1 100%
react-native-root-toast ^3.2.0 → ^3.2.1
Run npm install to install new versions.
npm install