Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

react native - entry point for packager

I'm just starting out with react native. Everything was going ok but now when I run 'react-native run-ios' the packager is looking for js files in

<project-root>/node_modules/react-native/packager

instead of

<project-root>

If I run 'node node_modules/react-native/local-cli/cli.js start' it looks for files in the correct location.

This is happening in my existing project and if I create a new project using react native init. It started after I installed a new npm module. I've since reverted the change, re-installed modules, cleared the tmpdir cache, rebooted computer etc. Can I explicitly configure the packager entry point?

Any help greatly appreciated

C

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is a known issue with RN 0.45, I have also encountered this problem today after upgrading from 0.42.

https://github.com/facebook/react-native/issues/14246

The temporary solution until RN is fixed (next release?) is to run:

npm start -- -reset-cache

You can also try:

npm run start -- --root <mydir>

This will cause the packager to look in the correct location.

Until this is corrected it's a pain, as it means we have to invoke the reset every time the packager is started either from XCode or react-native run-ios.

The next release is later this month: https://github.com/facebook/react-native/releases/tag/v0.46.0-rc.0

Update This has now been fixed in release 0.45.1


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...