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

react-native 0.57.0-rc.0 - Error: ENOENT: no such file or directory [Windows] #20712

Closed
3 tasks
ExoMemphiz opened this issue Aug 17, 2018 · 44 comments
Closed
3 tasks
Labels
Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@ExoMemphiz
Copy link

ExoMemphiz commented Aug 17, 2018

Environment

[skip envinfo]
Windows 10, trying to run on Android.

Description

Tried to run the newest NPM package of 0.57.0-rc.0 (Hoping it would fix AccessibilityInfo error)
I ran into this error instead:

 BUNDLE  [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)::ffff:127.0.0.1 - - [17/Aug/2018:11:25:37 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.10.0"
error: bundling failed: Error: ENOENT: no such file or directory, lstat 'D:\Development\Action Menu\testVersion2\node_modules\react-native\scripts\index.js'
    at Object.realpathSync (fs.js:1657:15)
    at DependencyGraph.getSha1 (D:\Development\Action Menu\testVersion2\node_modules\metro\src\node-haste\DependencyGraph.js:236:29)
    at D:\Development\Action Menu\testVersion2\node_modules\metro\src\Bundler.js:203:56
    at Generator.next (<anonymous>)
    at step (D:\Development\Action Menu\testVersion2\node_modules\metro\src\Bundler.js:11:657)
    at D:\Development\Action Menu\testVersion2\node_modules\metro\src\Bundler.js:11:817
    at <anonymous>
 BUNDLE  [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.

Reproducible Demo

Run:

react-native init --version="0.57.0-rc.0" testVersion
cd testVersion
react-native run-android

@kelset kelset added Platform: Windows Building on Windows. Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. labels Aug 17, 2018
@gengjiawen
Copy link
Contributor

Have the same issue:

 BUNDLE  [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)::ffff:127.0.0.1 - - [17/Aug/2018:13:11:28 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.10.0"
error: bundling failed: Error: ENOENT: no such file or directory, lstat 'D:\Developer\FrontEnd\test_057\node_modules\react-native\scripts\index.js'
    at Object.realpathSync (fs.js:1430:7)
    at DependencyGraph.getSha1 (D:\Developer\FrontEnd\test_057\node_modules\metro\src\node-haste\DependencyGraph.js:236:29)
    at D:\Developer\FrontEnd\test_057\node_modules\metro\src\Bundler.js:203:56
    at Generator.next (<anonymous>)
    at step (D:\Developer\FrontEnd\test_057\node_modules\metro\src\Bundler.js:11:657)
    at D:\Developer\FrontEnd\test_057\node_modules\metro\src\Bundler.js:11:817
    at process._tickCallback (internal/process/next_tick.js:68:7)

@gengjiawen
Copy link
Contributor

Looks like something forget to bundle:
image

@kelset
Copy link
Contributor

kelset commented Aug 17, 2018

Hey folks thank for reporting, just double checked locally (on macOS) and it seems to me that it's not just Windows related (I'll remove the label) - I get this error /testVersion/node_modules/react-native/scripts/packager.sh: No such file or directory

My current hypotesis is that it's something outdated in the react-native run-xxx command, that instead of running the "latest" version of the command > node node_modules/react-native/local-cli/cli.js start runs an outdated version (that points to an old reference that is not there anymore).

Can you try to run npm start to manually start the packager and then in a second window run the react-native run-xxx command again?

@gengjiawen
Copy link
Contributor

You can use npm run start to start the dev server as an workaround.

@gengjiawen
Copy link
Contributor

And I also tried the android release build, works too.

@timri
Copy link

timri commented Aug 17, 2018

The bundler, when spawned from "react-native run-android", looks in node_modules/react-native/scripts first, when I interpret the message correctly. See screenshot (unfortunatly I can not mark&copy text in that window):
image

When I use "react-native start", only the project-dir is searched (but 3 times??):

D:\vagrant\TestWin>react-native start
Scanning folders for symlinks in D:\vagrant\TestWin\node_modules (24ms)

┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│  Running Metro Bundler on port 8081.                                         │
│                                                                              │
│  Keep Metro running while developing on any JS projects. Feel free to        │
│  close this tab and run your own Metro instance if you prefer.               │
│                                                                              │
│  https://github.com/facebook/react-native                                    │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

Looking for JS files in
   D:\vagrant\TestWin
   D:\vagrant\TestWin
   D:\vagrant\TestWin

Loading dependency graph, done.
 BUNDLE  [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (505/505), done.

::ffff:127.0.0.1 - - [17/Aug/2018:18:23:53 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 200 - "-" "okhttp/3.10.0"

The good news is, that 0.57.0-rc.0 seems to fix #20353 (I would comment that there, however that issue is locked....)

@timri
Copy link

timri commented Aug 17, 2018

Fixing this seems easy, when I replace

const procConfig = {cwd: scriptsDir};

with

  const procConfig = {};

"react-native run-android" works (on windows), because otherwise the scripsDir is taken as projectRoot for the packager, since that is the default-value in

const appRoot = process.cwd();

At least if I understand the code correctly here, it's the first time I look into the react-native-code ;-)
Or maybe it should better be set to the root-Folder (explicitly)?

@kelset
Copy link
Contributor

kelset commented Aug 17, 2018

Hey Tim, thanks for the investigation, it seems to be in line with my hypothesis. Want to try and submit a PR for it? I feel like the same error will be found on the runIOS file

@ferily7
Copy link

ferily7 commented Aug 17, 2018

I tried what @timri did with the procConfig, but I still seem to get the same error:

bundling failed: Error: ENOENT: no such file or directory, lstat 'C:\Users\user\Documents\Test\node_modules\react-native\scripts\index.js'
    at Object.realpathSync (fs.js:1657:15)
    at DependencyGraph.getSha1 (C:\Users\user\Documents\Test\node_modules\metro\src\node-haste\DependencyGraph.js:236:29)
    at C:\Users\user\Documents\Test\node_modules\metro\src\Bundler.js:203:56
    at Generator.next (<anonymous>)
    at step (C:\Users\user\Documents\Test\node_modules\metro\src\Bundler.js:11:657)
    at C:\Users\user\Documents\Test\node_modules\metro\src\Bundler.js:11:817
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Edit: For some reason it didn't work for me the other day, but I just tested it today and it worked!

@sharathk
Copy link

I'm on Windows 10 and Tried as @timri suggested

In react-native/local-cli/runAndroid/runAndroid.js

Line 365 in 625c54d
const procConfig = {cwd: scriptsDir};
with
const procConfig = {};

Worked for me..

@kesha-antonov

This comment has been minimized.

@kelset
Copy link
Contributor

kelset commented Aug 18, 2018

Ok, so. I spent some time trying to understand what this is caused by and I found two "different" issues.

First one, basically on macOS when run-XXX get called this file gets executed launchPackager.command but this file references packager.sh which doesn't get bundled in the "node_module" version of react-native. I don't know why this happens but, yeah, I feel like packager.sh needs to be in the node_module. (cc @hramos maybe you know why it's not there?)
BTW, if I manually add the script, the command gets run properly and the Metro packager runs, but when it tries to bundle gives me back this error:

error: bundling failed: Error: ENOENT: no such file or directory, lstat '/private/tmp/RNTestProject/node_modules/react-native/index.js'
    at Object.realpathSync (fs.js:1421:7)
    at DependencyGraph.getSha1 (/private/tmp/RNTestProject/node_modules/metro/src/node-haste/DependencyGraph.js:236:29)
    at /private/tmp/RNTestProject/node_modules/metro/src/Bundler.js:203:56
    at Generator.next (<anonymous>)
    at step (/private/tmp/RNTestProject/node_modules/metro/src/Bundler.js:11:657)
    at /private/tmp/RNTestProject/node_modules/metro/src/Bundler.js:11:817
    at process._tickCallback (internal/process/next_tick.js:68:7)

The second issue is related to the bundler, and I think I figured out why, or, at least, which commit may be related to the issue. Looking at the history for react-native/local-cli/cliEntry.js and react-native/local-cli/core/index.js one of the last commits is by @CompuIves and it seems to be related to the config that gets passed around the CLI.

Two more people who may have a better understading of why the run command fails to load the bundler with the right configuration are @janicduplessis and @rafeca.

@kesha-antonov

This comment has been minimized.

@gengjiawen
Copy link
Contributor

The package.sh is removed by one of my prs to make it test RNTester cross-platform, not sure why it affect this. Is it run-android use different method on winodws platform ?

@CarGuo

This comment has been minimized.

@kelset
Copy link
Contributor

kelset commented Aug 20, 2018

@gengjiawen I don't think it "strictly" affects this issue, it's simply something that I found out during my investigation (so, like, a side issue) - but I think that then we need to reverse that change to re-add that file. Would it be possible?

@gengjiawen
Copy link
Contributor

Okay, I will create a pr, I removed it because I the file is redundant at that time.

@gengjiawen
Copy link
Contributor

@kelset PR created: #20751.

@gengjiawen
Copy link
Contributor

gengjiawen commented Aug 20, 2018

Also, as I mentioned earlier, this has workaround. You can use npm run start to start the dev server.

@gengjiawen
Copy link
Contributor

gengjiawen commented Aug 20, 2018

I checked the log again, looks like metro find the wrong project roots. cc @rafeca

Looking for JS files in
   D:\Developer\FrontEnd\test_057\node_modules\react-native\scripts
   D:\Developer\FrontEnd\test_057
   D:\Developer\FrontEnd\test_057

@dmead
Copy link

dmead commented Aug 22, 2018

I made the fix as discussed above on line 365 of runAndroid.js

It's does eliminate that error, but i'm left with this error
androiderror

@fungilation
Copy link

I'm getting a different error but related to Metro also (on Windows), after upgrading to 0.57.0-rc.0:

> react-native run-android
Scanning folders for symlinks in C:\Users\Gary\Documents\code\WonderSwipe\node_modules (29ms)
(node:21456) UnhandledPromiseRejectionWarning: Error: Cannot find module 'metro/src/blacklist'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\Users\Gary\Documents\code\WonderSwipe\rn-cli.config.js:3:19)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Module._compile (C:\Users\Gary\Documents\code\WonderSwipe\node_modules\pirates\lib\index.js:83:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.newLoader [as .js] (C:\Users\Gary\Documents\code\WonderSwipe\node_modules\pirates\lib\index.js:88:7)
    at Module.load (internal/modules/cjs/loader.js:599:32)
(node:21456) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:21456) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

npm start hits the same error.

facebook-github-bot pushed a commit that referenced this issue Aug 23, 2018
Summary:
@public

This diff fixes the `projectRoot` calculation on React Native when the app does not have a config file. This should fix the issues reported in #20712

Reviewed By: hramos

Differential Revision: D9444982

fbshipit-source-id: 4cb41fa5224d2addf92976cc119e49dea6a6346b
hramos pushed a commit that referenced this issue Aug 23, 2018
Summary:
@public

This diff fixes the `projectRoot` calculation on React Native when the app does not have a config file. This should fix the issues reported in #20712

Reviewed By: hramos

Differential Revision: D9444982

fbshipit-source-id: 4cb41fa5224d2addf92976cc119e49dea6a6346b
@kelset
Copy link
Contributor

kelset commented Aug 23, 2018

Looks like @rafeca committed a fix for this, we have cherry picked it and will be out with rc3.

In the meantime, can anyone test if master is now fixed?

@zenz
Copy link

zenz commented Aug 23, 2018

@kelset, It dosen't work I replace local-cli/util/Config.js with @rafeca's committed version, but same error appeared.

@kelset
Copy link
Contributor

kelset commented Aug 23, 2018

@zenz I just tested locally myself and I can confirm that Rafael's commit fixes the run-XXX command starting the packager correctly (no triple search or errors). Both on iOS and Android.

To test them you need to git clone the repo, checkout to the 0.57 branch and then run ./scripts/test-manual-e2e.sh.

Probably you didn't clean your project properly while testing? Anyway, I think we'll proceed soon to release a rc3 version so that we can make sure it works fine for everyone.

@zenz
Copy link

zenz commented Aug 23, 2018

@kelset I did what you said, no luck. and .sh file is only workable under *nix, not windows.

@gengjiawen
Copy link
Contributor

Fixed on rc3. I have verified using react-native init --version="0.57.0-rc.3" testRc3.

@chakrihacker
Copy link
Contributor

I installed "0.57.0-rc.3" and I still have the error registerevents which is mentioned by @dmead

@gengjiawen
Copy link
Contributor

Is it a clean install, or an upgraded project ?

@chakrihacker
Copy link
Contributor

Clean install

@gengjiawen
Copy link
Contributor

gengjiawen commented Aug 25, 2018

Can you provide a reproduce repo ?

@dmead
Copy link

dmead commented Aug 25, 2018 via email

@joe307bad
Copy link

@dmead I am using Windows 10 and still have this issue with 0.57.0-rc.3

@zenz
Copy link

zenz commented Aug 27, 2018

I confirmed that 0.57.rc3 solved the problem. under windows 10.

@chakrihacker
Copy link
Contributor

@gengjiawen Here's the repo https://github.com/chakrihacker/testRc3 which I created with this react-native init --version="0.57.0-rc.3" testRc3

@zenz
Copy link

zenz commented Aug 27, 2018

@chakrihacker I download your app and do react-native run-android, it's running well. I think you should check your system configuration.

@chakrihacker
Copy link
Contributor

chakrihacker commented Aug 27, 2018

My react-native-cli version is 2.0.1 and I am using react-native for past 6 months and my latest is on 0.55.4, what system configuration should I check?

I have the same error what @timri had

@zenz
Copy link

zenz commented Aug 27, 2018

@chakrihacker did you use yarn for package management? or npm? which version?
I'm using yarn 1.7.0, and updating android build-tools to 27.0.3 and platform27.

@chakrihacker
Copy link
Contributor

chakrihacker commented Aug 27, 2018

I'm using yarn 1.9.4 with same android build-tools and platform.

I am getting this error ::ffff:127.0.0.1 - - [27/Aug/2018:11:08:16 +0000] "GET /index.delta?platform=android&dev=true&minify=false&deltaBundleId=10e3175f5899423e HTTP/1.1" 200 - "-" "okhttp/3.10.0"

aleclarson pushed a commit to aleclarson/react-native that referenced this issue Sep 16, 2018
Summary:
@public

This diff fixes the `projectRoot` calculation on React Native when the app does not have a config file. This should fix the issues reported in facebook#20712

Reviewed By: hramos

Differential Revision: D9444982

fbshipit-source-id: 4cb41fa5224d2addf92976cc119e49dea6a6346b
aleclarson pushed a commit to aleclarson/react-native that referenced this issue Sep 16, 2018
Summary:
add `packager.sh` for run-android task for unix like system. This only fix on linux and macOS.
pass all current ci.
none
 [GENERAL] [BUGFIX] [CLI] - add `packager.sh` back for run-android task
Pull Request resolved: facebook#20751

Differential Revision: D9398197

Pulled By: hramos

fbshipit-source-id: 213b066c0c034136c5ad5bbf8d45c6f331b1d185
aleclarson pushed a commit to aleclarson/react-native that referenced this issue Sep 16, 2018
Summary:
@public

This diff fixes the `projectRoot` calculation on React Native when the app does not have a config file. This should fix the issues reported in facebook#20712

Reviewed By: hramos

Differential Revision: D9444982

fbshipit-source-id: 4cb41fa5224d2addf92976cc119e49dea6a6346b
aleclarson pushed a commit to aleclarson/react-native that referenced this issue Sep 16, 2018
Summary:
@public

This diff fixes the `projectRoot` calculation on React Native when the app does not have a config file. This should fix the issues reported in facebook#20712

Reviewed By: hramos

Differential Revision: D9444982

fbshipit-source-id: 4cb41fa5224d2addf92976cc119e49dea6a6346b
@joegoodall2
Copy link

@chakrihacker Did you get this resolved?
#20712 (comment)

@chakrihacker
Copy link
Contributor

It's working, you can close this issue

@facebook facebook locked as resolved and limited conversation to collaborators Sep 20, 2018
t-nanava pushed a commit to microsoft/react-native-macos that referenced this issue Jun 17, 2019
Summary:
add `packager.sh` for run-android task for unix like system. This only fix on linux and macOS.
pass all current ci.
none
 [GENERAL] [BUGFIX] [CLI] - add `packager.sh` back for run-android task
Pull Request resolved: facebook#20751

Differential Revision: D9398197

Pulled By: hramos

fbshipit-source-id: 213b066c0c034136c5ad5bbf8d45c6f331b1d185
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests