[Please help] expo export runs hell slow on Ubuntu 20

Hi there,

I’am trying to setup I automated pipeline to export bundles for self-hosted webserver with latest expo.

The dedicated machine is a EC2 T2.micro, with AMDx64 2,5ghz, 1GB ram, Ubuntu 2.0.

When the Metro Bundler kicks in, the compiler freezes at 2% forever.

Meanwhile the CPU has 120% load from node process.

I know it is a minimal hardware config with small cpu credit, but should this be that extremely hyper slow?

I’ve tried EXOTIC mode, all supported node versions (also Node17), tried different babel presets, but nothing is changing.

Please some can help me discover the issue?

Thanks,
Ivan

Most likely memory is a problem, you can try setting env variable NODE_OPTIONS=--max-old-space-size=700. Try experimenting with that value, it is in MB and it needs to be lower than the total amount, but if it is to low it will kill a js process if it allocates more than that amount.

According to https://support.circleci.com/hc/en-us/articles/360009208393-How-can-I-increase-the-max-memory-for-Node- setting that value to less than 2 GB might cause some issues, so it’s a long shot

2 Likes

Unfortunately, the cpu usage is still 120% with the maximum possible decreas. :frowning:
It freezes at 2% of the bundling process

does this happen on any project or just yours? can you try running expo export on a blank new project and check the result?

it happens with expo init full blank project too. Basically, I cannot press Ctr+C to break the process, since the CPU is dying. Same happens on a different fresh new Ubuntu server…

you could try installing watchman (Installation | Watchman)

in general this isn’t something we have too much control over at the moment because we use react-native’s default bundler, metro. you may be able to find more information and possible workarounds on GitHub - facebook/metro: 🚇 The JavaScript bundler for React Native.

All right, I’ll try to ask the Metro guys. Thank you!

Also, I’ve discovered another issue on multiple linux machines, maybe that could lead to the source of the my Ubuntu problem.
I’ve added some standard option for “babel-preset-expo”, but seems that the preset script works different on linux platforms.

Reproduce with new blank project:

expo init, then adding any documented options to babel.config.js
['babel-preset-expo', { jsxRuntime: 'classic' }]

Note: Works perfectly on OSX, Windows, but gives the following error on linux:

index.js: Unknown option: .jsxRuntime. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
- Maybe you meant to use
"presets": [
  ["babel-preset-expo", {
  "jsxRuntime": "classic"
}]
]
To be a valid preset, its name and options should be wrapped in a pair of brackets

Any ideas why is the babel so ill on linux?

can you share your full babel.config.js file?