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

ENOENT packager.env when building RN from source during react-native run-android #126

Closed
Jyrno42 opened this issue Jan 25, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@Jyrno42
Copy link

Jyrno42 commented Jan 25, 2019

Environment

$ react-native info

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (4) x64 Intel(R) Core(TM) i5-6600 CPU @ 3.30GHz
      Memory: 726.04 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.6.0 - /usr/local/bin/node
      Yarn: 1.12.3 - /usr/local/bin/yarn
      npm: 6.5.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
      Android SDK:
        API Levels: 19, 27, 28
        Build Tools: 27.0.3, 28.0.2
        System Images: android-19 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-25 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.1 AI-173.4819257
      Xcode: 9.4/9F1027a - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3
      react-native: git://github.com/jyrno42/react-native.git#bf64df4aea3f8ecda3fd9cfc2ed25e9f61ac905b => 1000.0.0
    npmGlobalPackages:
      react-native-cli: 2.0.1

Description

I have to manually create the directory node_modules/@react-native-community/cli/scripts to get the packager to start when using RN from source. Note, the issue only occurs when running react-native run-android.

Reproducible Demo

  1. Clone https://github.com/Jyrno42/rn-geoloctest
    • git clone git@github.com:Jyrno42/rn-geoloctest.git
  2. yarn
  3. yarn android
  4. Get the following output:
$ yarn android
yarn run v1.12.3
$ react-native run-android
Starting JS server...

ENOENT: no such file or directory, open '/Users/me/Documents/projects/rn-geoloctest/node_modules/@react-native-community/cli/scripts/.packager.env'

Error: ENOENT: no such file or directory, open '/Users/me/Documents/projects/rn-geoloctest/node_modules/@react-native-community/cli/scripts/.packager.env'
    at Object.openSync (fs.js:450:3)
    at Object.writeFileSync (fs.js:1212:35)
    at startServerInNewWindow (/Users/me/Documents/projects/rn-geoloctest/node_modules/@react-native-community/cli/build/runAndroid/runAndroid.js:185:6)
    at isPackagerRunning.then.result (/Users/me/Documents/projects/rn-geoloctest/node_modules/@react-native-community/cli/build/runAndroid/runAndroid.js:77:7)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)

error Command failed with exit code 1.
  1. Run mkdir node_modules/@react-native-community/cli/scripts
  2. Run yarn android again, packager now starts
@Jyrno42 Jyrno42 added the bug Something isn't working label Jan 25, 2019
@sidferreira
Copy link

Had the same issue, but creating the folder didn't work for me.
I believe is related to

where a lot of stuff that was in the main react-native repo was copied to the cli, but the scripts folder still in the main repo.

I tried to copy the scripts folder to node_modules/react-native/node_modules/@react-native-community/cli/ but error still happens.

But when I changed

https://github.com/react-native-community/react-native-cli/blob/2ff7ef9260f63c0d7e37401f57bd3d1ebd4597b4/packages/cli/src/runAndroid/runAndroid.js#L224

adding extra '..', to fix the path, it accessed the node_modules/react-native/scripts folder properly.

@grabbou grabbou added this to To do in RN 0.59 compat Jan 30, 2019
@sidferreira
Copy link

@grabbou Is there any planned schedule for that?

@grabbou
Copy link
Member

grabbou commented Jan 31, 2019

Yup. We want to fix this in next 2 weeks (see our "Next Release" project).

@grabbou
Copy link
Member

grabbou commented Feb 1, 2019

Ouch, this makes run-android totally broken. We are going to release a fix and include it in next RC.

RN 0.59 compat automation moved this from To do to Done Feb 1, 2019
thymikee pushed a commit that referenced this issue Feb 1, 2019
Fixes #126 

We need to change this approach, issue tracking in #140.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Development

No branches or pull requests

3 participants