metro icon indicating copy to clipboard operation
metro copied to clipboard

Metro bundler has encountered an internal error

Open KnowMighT opened this issue 8 years ago • 49 comments

When I run yarn start in the terminal and use Expo App to open my RN Project in iPhone, an error appears as follows:

qq20171228-164317 2x

KnowMighT avatar Dec 28 '17 08:12 KnowMighT

Do you have any more information about the error? Any log shown on the terminal would help

rafeca avatar Jan 02 '18 12:01 rafeca

@rafeca There is only Failed building JavaScript bundle on the terminal. I can successfully run on Android but fail on iOS, neither iPhone or simulator.

I'm not sure that this problem is caused by metro. I created a new project and encountered the same problem, so maybe not code itself.

KnowMighT avatar Jan 03 '18 11:01 KnowMighT

Ok so I was having the same issue but I just restarted my IDE, command line and ran the app again it worked fine.

qsmrf56 avatar Jan 07 '18 13:01 qsmrf56

Decided to try Expo today for the first time since last summer. Was eager to see what's new. Started with exp init, chose the 'blank' app, followed by exp start Installed Expo on my physical iPhone and attempted to connect via QR code. Unfortunately got the same error as OP on physical iPhone. Couldn't get Simulator to connect to Expo either. I didn't try Android.

onpaws avatar Jan 09 '18 16:01 onpaws

This appears to be something very new, I haven't seen a problem like that before. Started out of nowhere, no helpful logs.. image

mkrn avatar Jan 10 '18 12:01 mkrn

I'm having a similar problem. :( I also do not have any interesting logs. http://snack.expo.io works perfectly with the same project.

img_0835

vincekruger avatar Jan 11 '18 09:01 vincekruger

@vincekruger Thanks for mentioning that about Snack working. I was able to get things started that way at least. While a web IDE is far from ideal at least it's something.

onpaws avatar Jan 14 '18 18:01 onpaws

@rafeca The out of the box experience is broken for me and these other folks, and coming up on a week with no response. Would appreciate your opinion here :)

onpaws avatar Jan 14 '18 18:01 onpaws

Hey people! I'd need some more specific logs/repro steps in order to investigate this.

I've tried to reproduce it in React Native v0.52 with my test app (https://github.com/rafeca/rn-test-app) and I cannot see such error, so this may be an issue with the expo CLI integration.

rafeca avatar Jan 15 '18 11:01 rafeca

Thanks for checking @rafeca! Seeing as it's apparently specific to Expo, I'll be happy to pass the issue over there.

The problem is the Expo folks have disabled their issue tracker on GH. If anyone here happens to know their preferred channel to file bugs, or their Slack, etc I'll be happy to pass this along.

onpaws avatar Jan 15 '18 16:01 onpaws

I suspect there is some bug with npm 5 causing problems for people here, but nobody here actually provides steps to reproduce the problem so it's hard to say (as it works as expected for me and many thousands of other people). Please use npm 4 npm i -g npm@4 or yarn (https://yarnpkg.com/en/docs/install).

brentvatne avatar Jan 15 '18 17:01 brentvatne

Over on the Expo thread I opened, Brent helpfully recommended using yarn because npm5 apparently still has bugs.

In my case, even though I don't recall using npm to install exp, I nevertheless did a npm uninstall -g exp followed by yarn global add exp

and I'm back in business. If you get a chance to try this, please post back if it worked for you.

Hope it helps!

onpaws avatar Jan 15 '18 17:01 onpaws

I had the same issue, npm start -- -- reset-cache solved it, if it says cant run on port **** kill thoose process and reset again

martonczirjak avatar Jan 18 '18 11:01 martonczirjak

@marcinkosiba it doesn't work for me : (

KnowMighT avatar Jan 21 '18 11:01 KnowMighT

@onpaws Thanks for investigating this problem. I have tried to npm uninstall -g exp followed by yarn global add exp, but it also doesn't work for me. I think I'd go crazy!😭

KnowMighT avatar Jan 21 '18 13:01 KnowMighT

React Native doesn't work with NodeJS 9 and new version of NPM You have to downgrade your NodeJS version or you can use NVM to set different node version for each terminal: https://github.com/creationix/nvm

Downgrade your node version to: 8.9 and your NPM version to: 4.6.1

after that remove your node_modules directory and run npm install again

serdarde avatar Jan 25 '18 11:01 serdarde

It doesn't appear to work with ANY version of node & npm.

joelachance avatar Jan 25 '18 16:01 joelachance

Yeah same issue with me, i’ve tried using npm3.10.10 still the same, create new project, run on device (genymotion or even on iOS), get the metro bundler internal error

nukes88 avatar Jan 27 '18 00:01 nukes88

Fam, I fixed my issue and like most of them, it's completely my fault. I was refactoring and deleted some files without cleaning up some imports of the deleted files. The only way I found this was to add a console.log in metro (node_modules/metro/src/lib/formatBundlingError.js).

function formatBundlingError(error) { console.log(error); }

GentryRiggen avatar Jan 29 '18 04:01 GentryRiggen

I just made a curious discovery. I had a plus character + in the absolute path to my project folder, e.g. /Users/pat/projects/+ReactNative/MyExpoProject

I moved my project to a new path: /Users/pat/projects/MyExpoProject restarted everything, and we're off to the races.

onpaws avatar Jan 29 '18 15:01 onpaws