针对taro的升级有几种方案,如下:
全局安装
npm i @tarojs/cli -g
taro info 👽 Taro v3.0.9 Taro CLI 3.0.9 environment info: System: OS: macOS High Sierra 10.13.6 Shell: 5.7 - /usr/local/bin/zsh Binaries: Node: 10.15.2 - ~/.nvm/versions/node/v10.15.2/bin/node Yarn: 1.19.1 - ~/.yarn/bin/yarn npm: 6.14.4 - ~/.nvm/versions/node/v10.15.2/bin/npm npmPackages: @tarojs/cli: ^3.0.9 => 3.0.9 @tarojs/components: 3.0.9 => 3.0.9 @tarojs/mini-runner: 3.0.9 => 3.0.9 @tarojs/react: 3.0.9 => 3.0.9 @tarojs/runtime: 3.0.9 => 3.0.9 @tarojs/taro: 3.0.9 => 3.0.9 @tarojs/webpack-runner: 3.0.9 => 3.0.9 babel-preset-taro: 3.0.9 => 3.0.9 eslint-config-taro: 3.0.9 => 3.0.9 eslint-plugin-taro: ^2.2.3 => 2.2.3 react: ^16.10.0 => 16.13.1 npmGlobalPackages: typescript: 3.7.2
- 安装成功就会展示最新版本
在项目工程中
npm update self 3.0.9 taro update project 3.0.9 npm install -D @tarojs/cli@3.0.9
- 注意一定能要执行npm install -D @tarojs/cli@3.0.9,否则可能安装不成功
还可以在package.json 中将对应需要升级的taro相关版本,替换为新版本。例如
"@tarojs/mini-runner": "3.0.9", "@tarojs/webpack-runner": "3.0.9",
- 这只是举例子,之前的版本是3.0.7 改为3.0.9 ,然后执行npm install重新安装依赖,确认 node_modules 中升级的依赖是不是已经变更为你指定安装的版本了。
- 注意,如果安装不成功,就在本地项目中,安装指定cli版本。npm install -D @tarojs/cli@3.0.9
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。