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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.62.2 -> 0.63.0-rc.0 Cannot find module node_modules/react-native/node_modules/@react-native-community/cli/build/bin.js #60

Closed
palkerecsenyi opened this issue Apr 17, 2020 · 6 comments

Comments

@palkerecsenyi
Copy link

Environment

System:
    OS: macOS 10.15.4
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 343.18 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.16.3 - ~/.nvm/versions/node/v10.16.3/bin/node
    Yarn: Not Found
    npm: 6.14.4 - ~/.nvm/versions/node/v10.16.3/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      Android NDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_232 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: ^0.63.0-rc.0 => 0.63.0-rc.0 
  npmGlobalPackages:
    *react-native*: Not Found

Upgrading version

0.62.2 -> 0.63.0-rc.0

Description

I've upgraded using https://react-native-community.github.io/upgrade-helper/?from=0.62.2&to=0.63.0-rc.0, and have run ./gradlew clean. When I run ./gradlew assembleRelease, I get the following error during the build:

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '/Users/palkerecsenyi/Documents/Projects/PalChat/node_modules/react-native/node_modules/@react-native-community/cli/build/bin.js
'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'node'' finished with non-zero exit value 1

Weirdly, the file it specifies (/Users/palkerecsenyi/Documents/Projects/PalChat/node_modules/react-native/node_modules/@react-native-community/cli/build/bin.js) does indeed exist:

image

It has the following contents:

#!/usr/bin/env node
"use strict";

require("./tools/gracefulifyFs");

var _ = require("./");

(0, _.run)();

//# sourceMappingURL=bin.js.map

Reproducible demo

project.ext.react = [
    enableHermes: true,
    hermesCommand: "../../node_modules/hermes-engine/%OS-BIN%/hermesc"
]
  • Run ./gradlew clean

  • Run ./gradlew assembleRelease

@grabbou
Copy link
Member

grabbou commented Apr 21, 2020

Hey,

Thanks for the report.

Does running ./assembleDebug work for you?
Does enabling / disabling Hermes fixes it for you?

@thymikee
Copy link
Member

thymikee commented Apr 21, 2020

Can you clear Watchman cache just in case? Metro is run with --reset-cache when built from Android assemble task, so we don't need to clear that, but Watchman may feed it with wrong information (e.g. previously you had CLI hoisted to top node_modules/ but now it's inside node_modules/react-native/node_modules/).

The command is:

watchman watch-del-all

@palkerecsenyi
Copy link
Author

palkerecsenyi commented Apr 21, 2020

@grabbou thanks for your reply! I can confirm that assembleDebug works perfectly, and everything works as expected. I also tried disabling Hermes by changing project.ext.react.enableHermes to false (I also ran Gradle clean), but this had no effect sadly.

@thymikee thanks, I just tried deleting node_modules and package-lock.json, then I ran watchman watch-del-all, reinstalled all the modules, and ran ./gradlew clean, but sadly the error is still there.

@palkerecsenyi
Copy link
Author

I can also confirm that this is not only an issue when upgrading.

I just tried reproducing the error with a blank project:

npx react-native init testapp --version 0.63.0-rc.0
cd testapp/android
./gradlew assembleRelease

And the same error occurred:
image

@nvdnvd00
Copy link

I met this issue, any update ?

@palkerecsenyi
Copy link
Author

I'm guessing this has been fixed now? facebook/react-native#28776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants