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

2.0.1 版运行 dva g route 出错 #1201

Closed
ljjsimon opened this issue Sep 8, 2017 · 3 comments
Closed

2.0.1 版运行 dva g route 出错 #1201

ljjsimon opened this issue Sep 8, 2017 · 3 comments

Comments

@ljjsimon
Copy link

ljjsimon commented Sep 8, 2017

Code to reproduce the issue: (请提供可复现的代码或者步骤)

dva new 完项目后,执行 dva g route users,出错

Expected behavior: (预期的正常效果)

Actual behavior: (实际效果)

dva g route users
/usr/local/lib/node_modules/dva-cli/bin/dva-generate
create routeComponent src/routes/Users.js, src/routes/Users.css
create route users with src/routes/Users.js
AssertionError [ERR_ASSERTION]: getRouterTree: component should be one of Router, Route, Redirect, IndexRedirect, IndexRoute
at parse (/usr/local/lib/node_modules/dva-cli/node_modules/dva-ast/lib/collections/Router.js:57:28)
at ret.children.node.children.filter.map.node (/usr/local/lib/node_modules/dva-cli/node_modules/dva-ast/lib/collections/Router.js:94:93)
at Array.map (native)
at parse (/usr/local/lib/node_modules/dva-cli/node_modules/dva-ast/lib/collections/Router.js:94:81)
at NodePath.simpleMap.path (/usr/local/lib/node_modules/dva-cli/node_modules/dva-ast/lib/collections/Router.js:117:13)
at NodePath. (/usr/local/lib/node_modules/dva-cli/node_modules/dva-ast/lib/collections/Helper.js:21:28)
at __paths.forEach (/usr/local/lib/node_modules/dva-cli/node_modules/jscodeshift/src/Collection.js:76:36)
at Array.forEach (native)
at Collection.forEach (/usr/local/lib/node_modules/dva-cli/node_modules/jscodeshift/src/Collection.js:75:18)
at Collection.simpleMap (/usr/local/lib/node_modules/dva-cli/node_modules/dva-ast/lib/collections/Helper.js:20:10)

Versions of packages used: (哪个库的哪个版本出现的问题)

2.0.1

@ljjsimon
Copy link
Author

ljjsimon commented Sep 8, 2017

route.js 里面

<Route path="/users" component={Users} />

放倒

<Switch/>

里面就好了

@sorrycc
Copy link
Member

sorrycc commented Sep 9, 2017

dva g route 暂不适用于 dva@2,感谢反馈。

@sorrycc sorrycc closed this as completed Sep 9, 2017
@LiuSuY
Copy link

LiuSuY commented Nov 10, 2017

我的dva 版本是0.8.2 也同样有这个错误请问如何解决

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

3 participants