React-native: [Unable to resolve module & ENOENT: no such file or directory

Created on 31 Dec 2015  ยท  14Comments  ยท  Source: facebook/react-native

Hi

I want to upgrade my React Native from 0.13.2 to 0.17, so as the instruction https://facebook.github.io/react-native/docs/upgrading.html#content
npm install --save [email protected] and then react-native upgrade
But when I run my project, the terminal say this:

Unable to resolve module requestAnimationFrame from /Users/xiong/Documents/meituan/frontend/bee/node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js
Unable to resolve module keyMirror from /Users/xiong/Documents/meituan/frontend/bee/node_modules/react-native/Libraries/Components/WebView/WebView.ios.js
Unable to resolve module ReactPropTypes from /Users/xiong/Documents/meituan/frontend/bee/node_modules/react-native/Libraries/Inspector/ElementProperties.js
Unable to resolve module ReactDefaultPerf from /Users/xiong/Documents/meituan/frontend/bee/node_modules/react-native/Libraries/Utilities/RCTRenderingPerf.js
Unable to resolve module ReactPropTypes from /Users/xiong/Documents/meituan/frontend/bee/node_modules/react-native/Libraries/CameraRoll/CameraRoll.js
...
...
...
Unable to resolve module ReactPropTypes from /Users/xiong/Documents/meituan/frontend/bee/node_modules/react-native/Libraries/LayoutAnimation/LayoutAnimation.js
Unable to resolve module keyMirror from /Users/xiong/Documents/meituan/frontend/bee/node_modules/react-native/Libraries/LayoutAnimation/LayoutAnimation.js
[00:46:03] find dependencies (494ms)
[00:46:03] transform
transforming [======== ] 21% 65/311Error: ENOENT: no such file or directory, open '/Users/xiong/Documents/meituan/frontend/bee/node_modules/react-native/packager/react-packager/src/DependencyResolver/polyfills/prelude_dev.js'
at Error (native)
transforming [======================================= ] 98% 304/311[10:17:56] request:/index.ios.bundle?platform=ios&dev=true
Error: ENOENT: no such file or directory, open '/Users/xiong/Documents/meituan/frontend/bee/node_modules/react-native/packager/react-packager/src/DependencyResolver/polyfills/prelude_dev.js'
at Error (native)

Locked

Most helpful comment

react-native upgrade ... took me a while to resolve it :/

All 14 comments

Hey shawnXiao, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

Hi there! A good thing to try in this case is rm -rf node_modules and then run npm install again from scratch. If this doesn't work for you, try out StackOverflow or Discord as @facebook-github-bot so kindly mentioned above :)

It's a cache issue. See: https://github.com/facebook/react-native/issues/1924

You need to clear your packager cache: rm -fr $TMPDIR/react-*
Or this appears to do the trick also: watchman watch-del-all

Fixed again with:

โฏ rm -fr $TMPDIR/npm* 
โฏ rm -fr $TMPDIR/*.json.gzip

If clearing the cache still doesn't work for you, do you have a project rn-cli.config.js defined?
Try without it. (Or make sure you base it on the node-modules/react-native/packager/rn-cli.config).

Tried all the things in this thread.

 5335  rm -rf node_modules/
 5336  npm install 
 5339  rm -fr $TMPDIR/react-*
 5340  watchman watch-del-all
 5341  rm -fr $TMPDIR/npm*
 5342  rm -fr $TMPDIR/*.json.gzip
 5343  cat rn-cli.config.js 
 (no file found) 

Still getting the error: ENOENT: no such file or directory, uv_chdir

Follow up: the source code I checked out did not have an ios folder, causing the start up of the app to fail. I fixed that at the source and it started up fine after pulling new code.

Just a very cryptic error message in this case.

I have the same situation. My project only has a android folder, but no ios one. Is there a similar command to react-native android that creates a bare iOS project?

How can I create a new iOS project based on the android React Native project that I have?

@marktani I think the answer is "find whoever made the project and get them to add the ios folder into their repo". Barring that, init a new project and copy over the ios folder from it -- but you'll have to edit the files to get them to work with your project, things like the name of the project. Sounds like a hassle. You might be better off initing a new project and copying your work into it.

Right, thanks for the help! I got it working by doing init as you said.

I am the one who created the project in the first place, but I did so on a Linux machine. I think that's why there was no ios folder being created...

think that's why there was no ios folder being created

That doesn't sound right. I don't have a linux vm handy to test it on though... On second thought I suppose it could be right because XCode won't run on linux. Wow, how lame would that be? Only being able to develop ios apps on a mac, even when using a cross-platform tool like RN?

react-native upgrade ... took me a while to resolve it :/

@julesmoretti
react-native upgrade worked

thx!

react-native upgrade will init your project config !!!

Was this page helpful?
0 / 5 - 0 ratings