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

使用1.2.22版本h5-router运行报错 #2665

Closed
qiangck opened this issue Apr 2, 2019 · 5 comments
Closed

使用1.2.22版本h5-router运行报错 #2665

qiangck opened this issue Apr 2, 2019 · 5 comments

Comments

@qiangck
Copy link

qiangck commented Apr 2, 2019

问题描述
[问题描述:Uncaught TypeError: (0 , _router.createHistory) is not a function]

复现步骤
[复现问题的步骤]

  1. 项目taro版本为1.2.4,本地taro版本为1.2.22
  2. 重新删除node_modules和package-lock.json并npm i重新安装,使用的是taobao源
  3. 项目依赖安装完成后npm run dev:h5启动项目后提示错误
  4. Uncaught TypeError: (0 , _router.createHistory) is not a function

[或者可以直接贴源代码,能贴文字就不要截图]

//报错地方为.temp/app.js文件第19行

const _taroHistory = createHistory({
  mode: "hash",
  basename: "/",
  customRoutes: {},
  firstPagePath: "/pages/home/index"
});

期望行为
之前可以正常运行,只是更换了环境

报错信息
app.js?d0a8:19 Uncaught TypeError: (0 , _router.createHistory) is not a function
at eval (app.js?d0a8:19)
at Object../.temp/app.js (app.js:915)
at webpack_require (app.js:767)
at fn (app.js:130)
at Object.0 (app.js:1604)
at webpack_require (app.js:767)
at app.js:902
at app.js:905

系统信息

Taro v1.2 及以上版本已添加 taro info 命令,方便大家查看系统及依赖信息,运行该命令后将结果贴下面即可。

  • 操作系统: [e.g. Mac 10.14.4]
  • Taro 版本 [e.g. v.1.2.22]
  • Node.js 版本 [e.g. v10.15.3]
  • 报错平台 [h5]
@taro-bot
Copy link

taro-bot bot commented Apr 2, 2019

欢迎提交 Issue~

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

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

Good luck and happy coding~

@qiangck qiangck closed this as completed Apr 2, 2019
@kennir
Copy link

kennir commented Apr 5, 2019

我在 1.2.23 上也碰到这个问题了,只是做了一个 taro update project

@leidenglai
Copy link
Contributor

我也遇到这个问题了。在1.2.17升级1.2.23,结果样式错乱,还原回1.2.17后报这个错,后来将@tarojs/cli 这个包也还原回去才好。yarn global add @tarojs/[email protected]
话说为什么小版本升级会导致不兼容??

@xsq007
Copy link

xsq007 commented Apr 10, 2019

我用taro 1.2.22也遇到了这个问题,解决办法是在项目里运行 taro update project 更新当前项目的taro依赖。

@MikyChow
Copy link

更新后,同样遇到了这个问题

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

5 participants