joshuamiller / map-todo-demo

A demo app using ClojureScript and React-Native
Eclipse Public License 1.0
7 stars 1 forks source link

React Packager fails #3

Open luposlip opened 6 years ago

luposlip commented 6 years ago

Hi Joshua!

First of all, thanks for sharing your project and presentation! I've tried to run the app, but keep getting the following error with react-native-cli 2.0.1 and react-native 0.47.1:

React packager ready.

Loading dependency graph...
Bundling `index.ios.js`  [development, non-minified, hmr disabled]  ░░░░░░░░░░░░
░░░░  0.0% (0/1)2017-10-27 22:14 node[45622] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-10-27 22:14 node[45622] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
 ERROR  Error watching file for changes: EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"Error watching file for changes:","filename":null}
Error: Error watching file for changes: EMFILE
    at _errnoException (util.js:1041:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1359:9)
Loading dependency graph...
Bundling `index.ios.js`  [development, non-minified, hmr disabled]  ░░░░░░░░░░░░
░░░░  0.0% (0/1)Process terminated. Press <enter> to close the window

I'm a complete noob to React Native - can you point me in the direction of a way to solve this?

Thanks, Henrik

joshuamiller commented 6 years ago

Looks like this might be your issue, and installing watchman with brew instead of npm might fix it: https://github.com/react-community/create-react-native-app/issues/281

luposlip commented 6 years ago

Will try that, and revert. Thanks!

luposlip commented 6 years ago

Well, the error is nicer now, but seem to persist:

Looking for JS files in
   /Users/user/map-todo-demo 

React packager ready.

Loading dependency graph, done.
Bundling `index.ios.js`  [development, non-minified, hmr disabled]  0.0% (0/1), failed.
error: bundling failed: "Cannot find entry file index.ios.js in any of the roots: [\"/Users/user/map-todo-demo\"]"
joshuamiller commented 6 years ago

If you have a newer version of React Native, it wants an index.js instead of an index.ios.js... you can either copy the ios version, or change the bundle location in AppDelegate.m (I think). I just ran into this as well, was going to put together a PR for re-natal to make that change.

luposlip commented 6 years ago

Thanks again, I'll try that, and get back to you :)

luposlip commented 6 years ago

OK. I uninstalled node completely, and reinstalled it with brew install node. Then I installed react-native again.

I forced the installation to 0.49.5 by npm install -g react-native@0.49.5.

It still gave me an error.

Then I changed from index.ios to index in AppDelegate.m. The result is the same error, except the missing file is now index.js:

React packager ready.

Loading dependency graph, done.
Bundling `index.js`  [development, non-minified]  0.0% (0/1), failed.
error: bundling failed: NotFoundError: Cannot find entry file index.js in any of the roots: ["/Users/user/map-todo-demo"]
    at DependencyGraph._getAbsolutePath (/Users/user/map-todo-demo/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:305:11)
    at DependencyGraph.getDependencies (/Users/user/map-todo-demo/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:283:4236)
    at Resolver.getDependencies (/Users/user/map-todo-demo/node_modules/metro-bundler/src/Resolver/index.js:129:5)
    at /Users/user/map-todo-demo/node_modules/metro-bundler/src/Bundler/index.js:642:39
    at Generator.next (<anonymous>)
    at step (/Users/user/map-todo-demo/node_modules/metro-bundler/src/Bundler/index.js:13:1336)
    at /Users/user/map-todo-demo/node_modules/metro-bundler/src/Bundler/index.js:13:1496
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

As a RN noob I know that the issue is probably not with your code but my setup. And if you can point me in the right direction I highly appreciate it! :)

luposlip commented 6 years ago

Tried to delete the folder, re-clone it, lein figwheel ios, and then force to either react-native version 0.44.0 or 0.49.5 with npm install --save react-native@VERSION.

In particular for version 0.49.5:

npm install --save react-native@0.49.5
npm install --save react@16.0.0-beta.5 react-dom@16.0.0-beta.5
react-native run-ios

With both versions it doesn't build:

ld: library not found for -lAirMaps
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **
joshuamiller commented 6 years ago

Ah, I think you need to run react-native link (to link the native maps library in there); I'll add that to the README then.

luposlip commented 6 years ago

I get 2 errors when I run react-native link:

Error: Cannot find module '/Users/user/enterlab/map-todo-demo/node_modules/babel-plugin-transform-es2015-block-scoping/package.json'

Error: Cannot find module '/Users/user/map-todo-demo/node_modules/react-native-maps/package.json'

Seems to me React Native is very fragile - I have only been able to run a single sample app I've found on github. And then of course create and run my own empty app :(

joshuamiller commented 6 years ago

You can always try rm -rf node_modules, or if it's still giving you trouble with that, use yarn which some people have had a little better luck with. Unfortunately you're right; NPM is kind of a disaster, and everything built on it is inherently rickety.

luposlip commented 6 years ago

Sorry for not updating this for a while. I've been starting my own POC from scratch. Will revert to this issue when I'm longer in my journey!