typeorm / react-native-example

Example project to demonstrate TypeORM with React Native.
65 stars 29 forks source link

[iOS] error: bundling failed: Error: Unable to resolve module `./build/index` #4

Open esutton opened 5 years ago

esutton commented 5 years ago

Has anyone succeeded to get this TypeORM example working on either iOS or Android?

I would love to find an ORM to replace Realm JS.

git clone https://github.com/typeorm/react-native-example.git
cd react-native-example
yarn
react-native run-ios

Results in red box error:

image

I cannot get Android to even get this far.

react-native run-android
Scanning folders for symlinks in /Users/jdoe/Documents/projects/react-native/typeorm_react-native-example/node_modules (20ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Looking for JS files in
   /Users/edward3/Documents/projects/react-native/typeorm_react-native-example 

Metro Bundler ready.

Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `./build/index` from `/Users/edward3/Documents/projects/react-native/typeorm_react-native-example/index.js`: The module `./build/index` could not be found from `/Users/edward3/Documents/projects/react-native/typeorm_react-native-example/index.js`. Indeed, none of these files exist:

  * `/Users/edward3/Documents/projects/react-native/typeorm_react-native-example/build/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)`
  * `/Users/edward3/Documents/projects/react-native/typeorm_react-native-example/build/index/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)`
    at ModuleResolver.resolveDependency (/Users/edward3/Documents/projects/react-native/typeorm_react-native-example/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:158:865)
    at ResolutionRequest.resolveDependency (/Users/edward3/Documents/projects/react-native/typeorm_react-native-example/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:92:16)
    at DependencyGraph.resolveDependency (/Users/edward3/Documents/projects/react-native/typeorm_react-native-example/node_modules/metro/src/node-haste/DependencyGraph.js:271:4465)
    at dependencies.map.relativePath (/Users/edward3/Documents/projects/react-native/typeorm_react-native-example/node_modules/metro/src/DeltaBundler/traverseDependencies.js:379:19)
    at Array.map (<anonymous>)
    at resolveDependencies (/Users/edward3/Documents/projects/react-native/typeorm_react-native-example/node_modules/metro/src/DeltaBundler/traverseDependencies.js:378:16)
    at /Users/edward3/Documents/projects/react-native/typeorm_react-native-example/node_modules/metro/src/DeltaBundler/traverseDependencies.js:203:33
    at Generator.next (<anonymous>)
    at step (/Users/edward3/Documents/projects/react-native/typeorm_react-native-example/node_modules/metro/src/DeltaBundler/traverseDependencies.js:296:307)
    at /Users/edward3/Documents/projects/react-native/typeorm_react-native-example/node_modules/metro/src/DeltaBundler/traverseDependencies.js:296:467
 BUNDLE  [ios, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.

Tips and suggestion are much appreciated.

mohannad-mamo commented 5 years ago

Hello @esutton I am also facing similar error. I ran: git clone https://github.com/typeorm/react-native-example.git cd react-native-example yarn react-native run-ios I got the errors about "Build input file cannot be found:" for double-conversion.cc, cached-powers.cc, diy-fp.cc, strtod.cc, fast-dtoa.cc, bignum.cc, fixed-dtoa.cc, bignum-dtoa.cc.

I noticed that react-native-sqlite-storage is not linked, so I did link it. now I got the error "'config.h' file not found"

So I cleaned the project and switched the build to legacy from the project settings. but the error stayed, I tried using relative path in project settings, but the error stayed the same.

mohannad-mamo commented 5 years ago

Hello @esutton

I have created a boiler plate for myself from scratch using the docs and two issues' comments:

  1. the problem with "experimentalDecorators" was solved using: https://github.com/zeit/next.js/issues/5231#issuecomment-464605072

  2. I had a problem with types -not sure why- but I had to specify the type in the entity, I got that thanks to: https://github.com/typeorm/typeorm/issues/2897#issuecomment-467538873

The repo was tested with ios & android, I hope it helps you https://github.com/sheva007/typeorm-boilerplate