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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

New project in RN 0.59.4 fails to bundle #24460

Closed
danielgindi opened this issue Apr 15, 2019 · 15 comments
Closed

New project in RN 0.59.4 fails to bundle #24460

danielgindi opened this issue Apr 15, 2019 · 15 comments
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Bundler 馃摝 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@danielgindi
Copy link
Contributor

danielgindi commented Apr 15, 2019

馃悰 Bug Report

Since 0.59.x, even 0.59.4 - I get this:

Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(Unable to resolve module `./../../../../usr/local/lib/node_modules/@react-native-community/cli/node_modules/react-transform-hmr/lib/index.js` from `/Users/dcg/Desktop/AwesomeProject/App.js`: The module `./../../../../usr/local/lib/node_modules/@react-native-community/cli/node_modules/react-transform-hmr/lib/index.js` could not be found from `/Users/dcg/Desktop/AwesomeProject/App.js`. Indeed, none of these files exist:
  * `/usr/local/lib/node_modules/@react-native-community/cli/node_modules/react-transform-hmr/lib/index.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)`
  * `/usr/local/lib/node_modules/@react-native-community/cli/node_modules/react-transform-hmr/lib/index.js/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)` (null))

__38-[RCTCxxBridge loadSource:onProgress:]_block_invoke.213
    RCTCxxBridge.mm:414
___ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE_block_invoke.118
__80-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]_block_invoke
-[RCTMultipartStreamReader emitChunk:headers:callback:done:]
-[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:]
-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]
__88-[NSURLSession delegate_streamTask:didBecomeInputStream:outputStream:completionHandler:]_block_invoke
__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
-[NSBlockOperation main]
-[__NSOperationInternal _start:]
_dispatch_client_callout
_dispatch_block_invoke_direct
_dispatch_client_callout
_dispatch_block_invoke_direct
dispatch_block_perform
__NSOQSchedule_f
_dispatch_client_callout
_dispatch_continuation_pop
_dispatch_async_redirect_invoke
_dispatch_root_queue_drain
_dispatch_worker_thread3
_pthread_wqthread
start_wqthread

And on the react-native start side:

error: bundling failed: Error: Unable to resolve module `./../../../../usr/local/lib/node_modules/@react-native-community/cli/node_modules/react-transform-hmr/lib/index.js` from `/Users/dcg/Desktop/AwesomeProject/App.js`: The module `./../../../../usr/local/lib/node_modules/@react-native-community/cli/node_modules/react-transform-hmr/lib/index.js` could not be found from `/Users/dcg/Desktop/AwesomeProject/App.js`. Indeed, none of these files exist:
  * `/usr/local/lib/node_modules/@react-native-community/cli/node_modules/react-transform-hmr/lib/index.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)`
  * `/usr/local/lib/node_modules/@react-native-community/cli/node_modules/react-transform-hmr/lib/index.js/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 (/usr/local/lib/node_modules/@react-native-community/cli/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:163:15)
    at ResolutionRequest.resolveDependency (/usr/local/lib/node_modules/@react-native-community/cli/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/usr/local/lib/node_modules/@react-native-community/cli/node_modules/metro/src/node-haste/DependencyGraph.js:283:16)
    at Object.resolve (/usr/local/lib/node_modules/@react-native-community/cli/node_modules/metro/src/lib/transformHelpers.js:261:42)
    at dependencies.map.result (/usr/local/lib/node_modules/@react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:399:31)
    at Array.map (<anonymous>)
    at resolveDependencies (/usr/local/lib/node_modules/@react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:18)
    at /usr/local/lib/node_modules/@react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:269:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/usr/local/lib/node_modules/@react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
 BUNDLE  [ios, dev] ./index.js 鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 0.0% (0/1), failed.

To Reproduce

  1. Create a new RN project
  2. react-native start --reset-cache
  3. react-native run-ios

Expected Behavior

Run.

Environment

  React Native Environment Info:
    System:
      OS: macOS 10.14.4
      CPU: (4) x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz
      Memory: 126.68 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.15.3 - /usr/local/bin/node
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 23, 25, 26, 27, 28
        Build Tools: 23.0.1, 23.0.3, 25.0.3, 26.0.1, 27.0.3, 28.0.1, 28.0.2, 28.0.3
        System Images: android-23 | Google APIs Intel x86 Atom_64, android-25 | Google Play Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5314842
      Xcode: 10.2/10E125 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.4 => 0.59.4 
@react-native-bot react-native-bot added the Tech: Bundler 馃摝 This issue is related to the bundler (Metro, Haul, etc) used. label Apr 15, 2019
@saxenanickk
Copy link
Contributor

saxenanickk commented Apr 15, 2019

@danielgindi Could you please tell me your project's devDependencies ?

@danielgindi
Copy link
Contributor Author

@saxenanickk It's a new project created by react-native-cli. If it matters then I'll have to wait for the evening to be in front of my machine.

@saxenanickk
Copy link
Contributor

@danielgindi Make sure there @babel/runtime is present there.

@danielgindi
Copy link
Contributor Author

{
  "name": "AwesomeProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "16.8.3",
    "react-native": "0.59.4"
  },
  "devDependencies": {
    "@babel/core": "7.4.0",
    "@babel/runtime": "7.4.2",
    "@react-native-community/eslint-config": "0.0.3",
    "babel-jest": "24.5.0",
    "eslint": "5.15.3",
    "jest": "24.5.0",
    "metro-react-native-babel-preset": "0.53.1",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

@saxenanickk
Copy link
Contributor

@danielgindi I just ran a sample project with your package.json config. There is no problem in your project.
Which Xcode version are you using ?

@danielgindi
Copy link
Contributor Author

@saxenanickk Latest xcode version.
Could you 7z and send me a similar fresh sample project - that proved to correctly bundle on your machine?
I want to compare the results, the package-lock, global npm dependencies, everything I can.
Because this is a weird one, and persists no matter how hard I scrub and clean the machine (and node/npm does not leave that much of a junk around anyway).

@saxenanickk
Copy link
Contributor

@danielgindi Share your email.

@danielgindi
Copy link
Contributor Author

@saxenanickk It's in my profile, but anyway here it is: [email protected]

@JKCooper2
Copy link

Is your react native cli update and coming from https://github.com/react-native-community/cli? Also that that babel.config is setup correctly: https://stackoverflow.com/questions/55671556/index-js-cannot-find-module-react-native-community-cli-node-modules-metro

I checked my installation and it doesn't have the react-transform-hmr package installed, so probably something is out of date

@danielgindi
Copy link
Contributor Author

@JKCooper2 It exists and configured fine. Also yes it's @react-native-community/cli.
I have to stress it out: The file it's looking for - actually exists, every time.

@danielgindi
Copy link
Contributor Author

danielgindi commented Apr 21, 2019

Doing react-native run-ios without start, letting it run launchPackager.command - works!

The difference is that it runs react-native/cli.js start, not react-native start from @react-native-community/cli. What's going on behind the scenes, is currently a riddle to me.

@danielgindi
Copy link
Contributor Author

Am I the only one this happens to?
This also happens with latest @react-native-community/cli

@bennyBk
Copy link

bennyBk commented Jun 11, 2019

Same problem here

@stale
Copy link

stale bot commented Sep 9, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 9, 2019
@stale
Copy link

stale bot commented Sep 16, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Sep 16, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Sep 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Bundler 馃摝 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests

6 participants