Taro CLI 與本地安裝運行時框架 @tarojs/taro-weapp 版本不一致, 請確保版本一致!

最近打開這個項目,yarn dev:weapp 時候報錯,cli 和項目版本衝突如下:

kyle@DESKTOP-LIPAM5T MINGW64 /d/yuwei-workspacke/web-frontend/icommunity/weapp-fontend/trunk/icommunity-weapp (master)
$ yarn dev:weapp
yarn run v1.22.4
$ npm run build:weapp -- --watch

> [email protected] build:weapp D:\yuwei-workspacke\web-frontend\icommunity\weapp-fontend\trunk\icommunity-weapp
> taro build --type weapp "--watch"

� Taro v2.1.5

開始編譯項目 icommunity-miniapp
錯誤  版本問題  Taro CLI 與本地安裝運行時框架 @tarojs/taro-weapp 版本不一致, 請確保版本一致!
提示  升級命令  升級到最新CLI:taro update self   升級到最新依賴庫:taro update project
提示  升級文檔  請參考 "常用 CLI 命令"中"更新" 章節:https://taro-docs.jd.com/taro/docs/GETTING-STARTED.html

Taro CLI:2.1.5             路徑:C:\Users\kyle\AppData\Local\Yarn\Data\global\node_modules\@tarojs\cli\package.json
@tarojs/taro-weapp:1.3.39   路徑:D:\yuwei-workspacke\web-frontend\icommunity\weapp-fontend\trunk\icommunity-weapp\node_modules\@tarojs\taro-weapp\package.json

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:weapp: `taro build --type weapp "--watch"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:weapp script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\kyle\AppData\Roaming\npm-cache\_logs\2020-04-21T04_54_27_742Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

package.json文件

	"dependencies": {
		"@tarojs/components": "1.3.39",
		"@tarojs/router": "1.3.39",
		"@tarojs/taro": "1.3.39",
		"@tarojs/taro-alipay": "1.3.39",
		"@tarojs/taro-h5": "1.3.39",
		"@tarojs/taro-qq": "1.3.39",
		"@tarojs/taro-quickapp": "1.3.39",
		"@tarojs/taro-swan": "1.3.39",
		"@tarojs/taro-tt": "1.3.39",
		"@tarojs/taro-weapp": "1.3.39",
		"nerv-devtools": "^1.5.6",
		"nervjs": "^1.5.6",
		"taro-ui": "^2.2.4"
	},
	"devDependencies": {
		"@tarojs/plugin-babel": "1.3.39",
		"@tarojs/plugin-csso": "1.3.39",
		"@tarojs/plugin-sass": "1.3.39",
		"@tarojs/plugin-uglifyjs": "1.3.39",
		"@tarojs/webpack-runner": "1.3.39",

安裝了對應 版本的 cli 工具

$ yarn global add @tarojs/[email protected]

項目ok了

kyle@DESKTOP-LIPAM5T MINGW64 /d/yuwei-workspacke/web-frontend/icommunity/weapp-fontend/trunk/icommunity-weapp (master)
$ yarn dev:weapp
yarn run v1.22.4
$ npm run build:weapp -- --watch

> [email protected] build:weapp D:\yuwei-workspacke\web-frontend\icommunity\weapp-fontend\trunk\icommunity-weapp
> taro build --type weapp "--watch"

� Taro v1.3.39

開始編譯項目 icommunity-miniapp
生成  工具配置  dist/project.config.json
編譯  入口文件  src/app.jsx
拷貝  NPM文件   dist/npm/@tarojs/taro/dist/index.js
拷貝  NPM文件   dist/npm/@tarojs/taro/index.js
拷貝  NPM文件   dist/npm/@tarojs/taro-weapp/dist/index.js
拷貝  NPM文件   dist/npm/@tarojs/taro-weapp/index.js
生成  入口配置  dist/app.json
生成  入口文件  dist/app.js
生成  入口樣式  dist/app.wxss
編譯  所有頁面

記得之前安裝 taro 提示操作,也可以解決問題

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章