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

Stuck in "Scanning folders for symlinks in..." #18290

Closed
Dentrax opened this issue Mar 9, 2018 · 41 comments
Closed

Stuck in "Scanning folders for symlinks in..." #18290

Dentrax opened this issue Mar 9, 2018 · 41 comments
Labels
Bug Platform: Windows Building on Windows. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@Dentrax
Copy link

Dentrax commented Mar 9, 2018

Environment

Environment:
  OS: Windows 10
  Node: 9.8.0
  Yarn: Not Found
  npm: 4.6.1
  Watchman: Not Found
  Xcode: N/A
  Android Studio: Version  3.0.0.0 AI-171.4443003

Packages: (wanted => installed)
  react: 16.2.0 => 16.2.0
  react-native: 0.52.0 => 0.52.0

Expected Behavior

When I'm trying to install app to Android Emulator, this problem occurs;

Scanning folders for symlinks in C:\Users\Furkan\AwesomeProject\node_modules (30ms)

Actual Behavior

-npm already running
-System Variables are OK
-CMD (via Administrator)
-Android 5.0.1 (API 21, All SDK components/Extras/Build Tools was installed)
-adb devices;

List of devices attached
emulator-5554   device
PS C:\Users\Furkan\AwesomeProject> react-native run-android --deviceId emulator-5554
Scanning folders for symlinks in C:\Users\Furkan\AwesomeProject\node_modules (30ms)
(and Terminated)

Steps to Reproduce

-run "npm start"
-run ".androidSDK/tools/emulator -avd Nexus6"
-run "react-native run-android" (when Android booted)

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest stable release?

Thank you for your contributions.

How to ContributeWhat to Expect from Maintainers

@react-native-bot react-native-bot added Old Version Ran Commands One of our bots successfully processed a command. labels Mar 9, 2018
@Dentrax
Copy link
Author

Dentrax commented Mar 9, 2018

When I ran react-native upgrade command, CMD says me;

Successfully upgraded this project to react-native v0.52.0
PS C:\Users\Furkan\AwesomeProject> react-native -v
react-native-cli: 2.0.1
react-native: 0.52.0

Edit: Same with npm install -g react-native-git-upgrade

@Dentrax
Copy link
Author

Dentrax commented Mar 9, 2018

Upgraded to 0.55 and still same.

@react-native-bot react-native-bot added Android Platform: Windows Building on Windows. and removed Old Version labels Mar 9, 2018
@Dentrax
Copy link
Author

Dentrax commented Mar 9, 2018

Update: It's works well with ;
Expo's npm start and press a key to open emulator

But react-native run-android not working.

@FriOne
Copy link

FriOne commented Mar 13, 2018

I have the same issue on Ubuntu

@simonracz
Copy link
Contributor

Same bug here on Mac. I am glad I found this ticket. I try to debug now why this happens.

@mathiassoeholm
Copy link

I had a similar problem when using Create React Native App. It turned out I simply had to eject before being able to run an Android build.

@simonracz
Copy link
Contributor

For me, the root of the issue was in watchman.

I solved it by sudo rm -rf /usr/local/var/run/watchman

https://stackoverflow.com/questions/45477184/built-stuck-at-0-0-while-bundling-index-ios-js/45477185#45477185

@jose2007kj
Copy link

me too stuck here

@jose2007kj
Copy link

problem seems solved after closing and opening the terminal and running the command

@DarksightKellar
Copy link

Restarting the terminal worked for me as well. Huh.

@hramos hramos removed the Platform: Windows Building on Windows. label Mar 29, 2018
@sumanstm21
Copy link

sumanstm21 commented Apr 15, 2018

for me this worked
init the project (once again)
react-native start (Terminal -> node)
react-native run-android(Treminal -> Powershell)

@kmute90
Copy link

kmute90 commented Apr 18, 2018

I was kind of silly, but maybe it will be useful to someone else.. I created two projects as the tutorial suggests:

I tried to run the command react-native run-android on a project created with:
create-react-native-app AwesomeProject -> the specified error happened here

However it is only available if you use the default project created with this command
react-native init AwesomeProject

@sumanstm21
Copy link

Check the SDK and and also in environment settings add "C:\Users<user>\AppData\Local\Android\Sdk\platform-tools" and "C:\Users<user>\AppData\Local\Android\Sdk\tools" to User Variable. As well add JAVA_HOME and ANDROID_HOME (path) to your system variable

@fptldl
Copy link

fptldl commented Apr 19, 2018

i solve the problem like this

  1. terminal 1 : npm start (wait utiil start)
  2. terminal2 : react-native run-android

@Dentrax
Copy link
Author

Dentrax commented Apr 19, 2018

npm start
react-native run-android

I don't think that's a solution. :) We may need a reasonable explanation of the cause of this bug.

@GabeAboy
Copy link

I created my React-Native application with expo and getting this same error. How about anybody else on expo?

@MichaelPote
Copy link

The problem for me was that the Metro Bundler (The window with title 'node "....\local-cli\cli.js" start') was open in the background from a previously terminated build.

After I closed that window, the new build process was able to spawn a new Metro Bundler and all proceeded fine from there.

@jakeOliv
Copy link

restart vs code and terminal worked. :)

@Dentrax
Copy link
Author

Dentrax commented May 16, 2018

"Restarting" is not a solution. Must have a rational explanation.

@Lollllipop
Copy link

Lollllipop commented May 18, 2018

Did you install using create-react-native-app AwesomeProject?

@vuquangnguyen-biglabs
Copy link

@Dentrax
you need to initialize the project first, following this steps
cd C:\Users\Furkan
react-native init AwesomeProject
cd AwesomeProject
react-native run-android

@kelset
Copy link
Contributor

kelset commented May 24, 2018

Uhm so it's a process that hangs, basically, right?

OP used npm: 4.6.1, have you tried upgrading to latest (v6 I think)? Does it still happen? Or, as @MichaelPote points out, is actually a Metro Bundler instance being kept alive in the background?

@Dentrax
Copy link
Author

Dentrax commented May 27, 2018

I do not know why, but there is no explanation in this bug. I think that explanations and details need to be improved. Isn't it? @kelset

@lastpeony
Copy link

i have same issue

@pacozaa
Copy link

pacozaa commented Jun 8, 2018

What's happening? I got this issue like out of nowhere!?

@Ryan-ED
Copy link

Ryan-ED commented Jun 8, 2018

Has this issue been addressed by any of the developers? It seems to be active and its something that is bothering a lot of users. Can we please get an update / some assistance?

Thanks

@pacozaa
Copy link

pacozaa commented Jun 9, 2018

I restart my laptop then it works. Still don't know why.

@chandankumarshanbhag
Copy link

Upgrade the react-native package

react-native upgrade
After doing this
*Make sure you are connected to the internet
**Bcz when you run the app for the first time it will download the gradle dependency

react-native run-android
*This command itself downloads all the gradle dependency

This method 100% works

@facebook facebook locked as resolved and limited conversation to collaborators Jun 18, 2018
@facebook facebook unlocked this conversation Jun 18, 2018
@chrisgrg
Copy link

chrisgrg commented Jun 27, 2018

The issue is simply because of some previous process which wouldn't have been properly terminated before.
for ubuntu just find the process using
sudo lsof -i:8081
terminate the process by
sudo -9 kill <your-process-id>

windows users can try by running cmd as admin then
netstat -ano | findstr :8081
terminate the process by
taskkill /PID <your-process-id> /F

hope this works cheers :)

@leo2d
Copy link

leo2d commented Jul 11, 2018

I have the same problem on Windows 10 and React Native version 0.55.4

@agm1984
Copy link

agm1984 commented Jul 16, 2018

+1 this just happened to me on Windows 10.

chrisgrp's answer contained the beauty I needed to fix it. It appears to be related to Metro Bundler getting stuck for unknown reason.

I have good insight into the error after loading a pre-existing project made in iOS onto my Windows PC. I was using React Native on a different PC before, so this Windows 10 machine is kind of semi-baked in terms of it's preparedness for React Native.

I did:

$ yarn install
$ yarn android

and it threw an error about SDK location, which I fixed by defining the path in ./android/local.properties (or alternately, you can define the ANDROID_HOME env variable). That started throwing an SDK licence warning. I fixed that by running the SDK Manager in Android Studio and installing API level 25.

Then, I ran yarn android again without a phone & USB cable hooked up, but the emulator was running in Android Studio. It either failed or I pressed CTRL+C to kill the process.

The next time I ran yarn android, I saw the behaviour described in this thread/issue.

This fixed it for me (remember, Windows only):

$ netstat -ano | findstr :8081
$ taskkill /PID <your-process-id> /F

The question is why did Metro Bundler hang or get stuck? and why can't it unstuck itself when you run yarn android ? The user shouldn't have to care if it's running or not. I might guess it's related to some setup or teardown reference/garbage collection issue.

I tied closing VS Code and reopening it, but that didn't work. I had to run taskkill.

@kelset
Copy link
Contributor

kelset commented Jul 16, 2018

👋 @agm1984 thanks for the detailed explanation!

Have you perhaps tried with any other bundlers (ex. Haul?)?
If there is "hard evidence" that is strictly related to Metro I think an issue in the dedicated repo should be opened so that the Metro team could take a closer look at it.

@kelset kelset added the Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. label Jul 16, 2018
@viv3kk
Copy link

viv3kk commented Jul 20, 2018

Follow these steps :

  1. sudo netstat -ntlp
    tcp6 1 0 :::8081 :::* LISTEN 13398/node
  2. sudo kill -9 [port 8081] i.e. sudo kill -9 13398

and then
3) react-native run-android

@kelset kelset added the Platform: Windows Building on Windows. label Jul 20, 2018
@heneliezer
Copy link

I had the same issue , And my problem was that the packager was already running (cli.js)

@kelset kelset removed the 🔧Tooling label Aug 3, 2018
@DavidNorena
Copy link

@chrisgrg you are right the same happens on windows :D, maybe you forgot to close another instance of the cli bundler :D

@agm1984
Copy link

agm1984 commented Sep 5, 2018

I just reproduced this error again, but this time in Ubuntu.

I usually trigger refreshes in the app by pressing CTRL+S even if I don't change any code. Sometimes I have to press it 2-3 times which brings a risk of red screen of death. But thats ok because you can just press CTRL+S again and it reloads properly.

Long story short, I just did that and it didn't work, so I ran adb shell input keyevent 82 from the terminal and selected 'Reload'. I think the bundler was already dead at this point because my screen was blank white with the green bar at the top "connecting to http://localhost:8081".

That force reload lead to hanging on the symlink scan:

Scanning folders for symlinks in /home/adam/dev/some-app/node_modules (16ms)

I fixed it with npm start, CTRL+C'd out of that and ran react-native run-android and it worked fine. Closing the VS Code instance and reopening it (to kill/reopen terminal) didn't fix it.

npm start did. It absolutely fixed it. After that, I see the commend in here about killing the process on port 8081. I'm sure that would fix it also.

The bundler gets stuck sometimes. If a person wants to reproduce it, just hammer on CTRL+S while hot reload is enabled :) You will surely see some opportunities to fix a stuck bundler.

I would venture a guess that if the bundler is in progress refreshing and you trigger another refresh, you can cause it to implode. It can occur about 50% of the time. The faster you trigger reloads, the higher the chance you will reproduce this or a similar issue.

@jayaramsurya
Copy link

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\native\AwesomeProject>react-native run-android
Scanning folders for symlinks in C:\native\AwesomeProject\node_modules (89ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat install
Debug)...

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':app'.

Failed to notify project evaluation listener.
Could not initialize class com.android.sdklib.repository.AndroidSdkHandler

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug
    option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 5s
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

@flikQ
Copy link

flikQ commented Oct 29, 2018

It looks like it's packager running in the background is what causes this, closing the packager terminal will then correct the problem and restart packager.

@cpojer
Copy link
Contributor

cpojer commented Mar 20, 2019

This issue has been moved to facebook/metro#377.

@cpojer cpojer closed this as completed Mar 20, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Mar 20, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Windows Building on Windows. Ran Commands One of our bots successfully processed a command. 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