Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taro降级后,版本混乱 #5172

Closed
darkfiredarkhalo opened this issue Dec 24, 2019 · 8 comments
Closed

taro降级后,版本混乱 #5172

darkfiredarkhalo opened this issue Dec 24, 2019 · 8 comments
Assignees

Comments

@darkfiredarkhalo
Copy link

darkfiredarkhalo commented Dec 24, 2019

问题描述

将原始项目(基于taro1.3.29创建的微信小程序项目)升级到2.0.0-beta.10,并依据#4837修改config,安装依赖后,使用yarn dev:h5运行,发现了一些问题(见#5165),之后降级,降级方法如下:

1, 使用yarn global add @tarojs/[email protected]降级cli, ( 使用 npm i -g @tarojs/[email protected] 报错: Unhandled rejection RangeError: Maximum call stack size exceededill install loadIdealTree);

2, 另建一个新项目(基于taro1.3.29)taro init xxx,并移植package.json; ( 进行这一步是因为2.0版本中新安装了两个babel插件,移除yarn remove的时候有问题,并且不知道taro的其他相关依赖和其版本是什么对应关系.至少不知道nervjs和taro的版本怎么对应,所以...)

3, 移除原项目中的 node_modules 目录和 yarn.lock 文件, 恢复config/index.js, 重新执行yarn install, 之后执行yarn dev:weapp, 无法运行项目

复现步骤

  1. 基于2.0.0-beta.10创建一个项目,之后降级到1.3.29(降级方法见问题描述)
  2. 使用taro dev:wepp运行

期望行为

能够正常降级,降级之后能正常运行项目

报错信息

错误  版本问题  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.0.0-beta.10             路径:/usr/local/Cellar/node/11.1.0/lib/node_modules/@tarojs/cli/package.json
@tarojs/taro-weapp:1.3.29   路径:/Users/shang/Desktop/Work/gusto_wx/node_modules/@tarojs/taro-weapp/package.json 

系统信息

Taro CLI 1.3.29 environment info:
    System:
      OS: macOS 10.15.2
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.16.0 - /usr/local/bin/node
      Yarn: 1.12.3 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
    npmPackages:
      @tarojs/async-await: 1.3.29 => 1.3.29 
      @tarojs/components: 1.3.29 => 1.3.29 
      @tarojs/components-qa: 1.3.29 => 1.3.29 
      @tarojs/plugin-babel: 1.3.29 => 1.3.29 
      @tarojs/plugin-csso: 1.3.29 => 1.3.29 
      @tarojs/plugin-uglifyjs: 1.3.29 => 1.3.29 
      @tarojs/router: 1.3.29 => 1.3.29 
      @tarojs/taro: 1.3.29 => 1.3.29 
      @tarojs/taro-alipay: 1.3.29 => 1.3.29 
      @tarojs/taro-h5: 1.3.29 => 1.3.29 
      @tarojs/taro-qq: 1.3.29 => 1.3.29 
      @tarojs/taro-quickapp: 1.3.29 => 1.3.29 
      @tarojs/taro-swan: 1.3.29 => 1.3.29 
      @tarojs/taro-tt: 1.3.29 => 1.3.29 
      @tarojs/taro-weapp: 1.3.29 => 1.3.29 
      @tarojs/webpack-runner: 1.3.29 => 1.3.29 
      eslint-config-taro: 1.3.29 => 1.3.29 
      eslint-plugin-taro: 1.3.29 => 1.3.29 
      nerv-devtools: ^1.5.5 => 1.5.6 
      nervjs: ^1.5.5 => 1.5.6 
      stylelint-config-taro-rn: 1.3.29 => 1.3.29 
      stylelint-taro-rn: 1.3.29 => 1.3.29 
@taro-bot
Copy link

taro-bot bot commented Dec 24, 2019

CC @luckyadam

@taro-bot
Copy link

taro-bot bot commented Dec 24, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Garfield550
Copy link
Collaborator

看报错信息里,Taro CLI 好像没降级成功?

项目内可以存在 @tarojs/cli 的,只要把它作为 devDependencies 安装到项目里,然后在 package.json 里配置对应的 scripts 就可以了,比如

{
  "scripts": {
    "build:weapp": "taro build --type weapp"
  },
  "devDependencies": {
    "@tarojs/cli": "1.3.29"
  }
}

这样就可以直接用 npm run 或者 yarn <script name> 来编译了。

@darkfiredarkhalo
Copy link
Author

可能是因为我的cli是用npm全局安装的,降级的时候npm出错了所以用了yarn,而yarn在全局安装cli的时候和npm不一样,所以导致运行时检测版本不一致.....
非常感谢您,您的意思是项目中可以单独采用和全局不一样的cli进行编译处理吗?

@Garfield550
Copy link
Collaborator

项目可以采用不同于全局的 CLI 版本,并且 npm runyarn run 优先采用项目里的。

@darkfiredarkhalo
Copy link
Author

收到,非常感谢!!!

@shenghanqin
Copy link
Collaborator

优先会用你当前项目的cli,而全局安装的cli适合给稳定项目用

@darkfiredarkhalo
Copy link
Author

好的,感谢!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants