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

按照reading项目 在自己项目中使用redux-saga 报regeneratorRuntime.mark错误 #91

Closed
wangliguang opened this issue Aug 16, 2017 · 7 comments

Comments

@wangliguang
Copy link

您好,我按照您的方式在项目中使用react-saga,出现如下错误,

undefined is not an object (evaluating regeneratorRuntime.mark) 。

我在网上查找资料说是因为babel无法转换ES6的函数生成器,我试了好几个网上的教程都不管用,但我运行你的项目就能正常运行起来。甚至我将你的package.json里面的内容复制过来重新npm install还是不行。

谢谢您的浏览,希望能得到您的指点。

@wangliguang wangliguang changed the title redux-saga的报 regeneratorRuntime.makk错误 按照项目中 在自己项目中使用redux-saga 报regeneratorRuntime.mark错误 Aug 16, 2017
@wangliguang wangliguang changed the title 按照项目中 在自己项目中使用redux-saga 报regeneratorRuntime.mark错误 按照reading项目 在自己项目中使用redux-saga 报regeneratorRuntime.mark错误 Aug 16, 2017
@Richard-Cao
Copy link
Member

Richard-Cao commented Aug 17, 2017

和babel有关,babel-preset-react-native,还有对应的react版本,你可以看下
改动之后可以清一下npm缓存,然后删了node_modules重新npm install

@wangliguang
Copy link
Author

`"dependencies": {
	"react": "16.0.0-alpha.12",
	"react-native": "0.47.1",
	"react-redux": "^5.0.6",
	"redux": "^3.7.2",
	"redux-logger": "^3.0.6",
	"redux-saga": "^0.15.6"
},
"devDependencies": {
	"babel-jest": "20.0.3",
	"babel-preset-react-native": "3.0.0",
	"jest": "20.0.4",
	"react-test-renderer": "16.0.0-alpha.12"

},`

上面是我package上的内容,我重新删过缓存也删除过node包重装,但都没用,您在使用saga出现过这个错误么,还是说您装过saga以后可以直接使用。

@Richard-Cao
Copy link
Member

Richard-Cao commented Aug 17, 2017

当然可以,reading里现在就有saga 你的babel-preset-react-native版本太新了,回退到reading使用的版本就可以了https://github.com/attentiveness/reading/blob/master/package.json#L45

@wangliguang
Copy link
Author

我把babel-preset-react-native 恢复到2.0.0,然后将node包删除,重新npm install,还是报上面说的错误

@Richard-Cao
Copy link
Member

Richard-Cao commented Aug 17, 2017

清下npm缓存。reading这么配置之后就没问题了。主要就是几个语法糖的不兼容。还有注意下node版本要>=6。可以参考这个issue:facebook/react-native#14838

@wangliguang
Copy link
Author

谢谢您的引导,通过下面几步我解决了问题

  1. npm i babel-preset-react-native@2.0.0 -D -S (千万不能直接在package.json里面将3.0.0改为2.0.0

  2. npm start -- --reset-cache

@Richard-Cao
Copy link
Member

其实直接改也可以,不过你问题解决了就行,哈哈

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

2 participants