Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Metro bundler process exited with code 1 #1407

Closed
Kramraes1 opened this issue Jan 4, 2020 · 13 comments
Closed

Metro bundler process exited with code 1 #1407

Kramraes1 opened this issue Jan 4, 2020 · 13 comments

Comments

@Kramraes1
Copy link

Kramraes1 commented Jan 4, 2020

Hello, I hope you can help me :) I am total new to building apps and react native, but tried to follow the "getting started" instructions on https://facebook.github.io/react-native/docs/getting-started.html.
Thanks in advance,
Pia

Description

My problem is when I try running the app with "yarn start" after "yarn global add expo-cli" (yarn v1.21.1, expo-cli@3.11.3), "expo init appname" and "cd appname" I get an error: "Metro Bundler process exited with code 1"

Expected Behavior

I typed:
"yarn global add expo-cli"
"expo init hcreacttest"
"cd hcreacttest"
"yarn start"
and expected to get connected to Localhost:19002 (as I did a few months ago).

Observed Behavior

C:\Users\Michael>yarn global add expo-cli
yarn global v1.21.1
[1/4] Resolving packages...
warning expo-cli > @expo/xdl > @expo/webpack-config > workbox-webpack-plugin > workbox-build > joi@11.4.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning expo-cli > @expo/xdl > @expo/webpack-config > workbox-webpack-plugin > workbox-build > joi > topo@2.0.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning expo-cli > @expo/xdl > @expo/webpack-config > workbox-webpack-plugin > workbox-build > joi > hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning expo-cli > @expo/xdl > @expo/webpack-config > workbox-webpack-plugin > workbox-build > joi > topo > hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info @expo/traveling-fastlane-darwin@1.11.3: The platform "win32" is incompatible with this module.
info "@expo/traveling-fastlane-darwin@1.11.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-darwin-ia32@2.2.8: The platform "win32" is incompatible with this module.
info "@expo/ngrok-bin-darwin-ia32@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-darwin-ia32@2.2.8: The CPU architecture "x64" is incompatible with this module.
info @expo/ngrok-bin-darwin-x64@2.2.8: The platform "win32" is incompatible with this module.
info "@expo/ngrok-bin-darwin-x64@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-freebsd-ia32@2.2.8: The platform "win32" is incompatible with this module.
info "@expo/ngrok-bin-freebsd-ia32@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-freebsd-ia32@2.2.8: The CPU architecture "x64" is incompatible with this module.
info @expo/ngrok-bin-freebsd-x64@2.2.8: The platform "win32" is incompatible with this module.
info "@expo/ngrok-bin-freebsd-x64@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-linux-arm@2.2.8: The platform "win32" is incompatible with this module.
info "@expo/ngrok-bin-linux-arm@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-linux-arm@2.2.8: The CPU architecture "x64" is incompatible with this module.
info @expo/ngrok-bin-linux-arm64@2.2.8: The platform "win32" is incompatible with this module.
info "@expo/ngrok-bin-linux-arm64@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-linux-arm64@2.2.8: The CPU architecture "x64" is incompatible with this module.
info @expo/ngrok-bin-linux-ia32@2.2.8: The platform "win32" is incompatible with this module.
info "@expo/ngrok-bin-linux-ia32@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-linux-ia32@2.2.8: The CPU architecture "x64" is incompatible with this module.
info @expo/ngrok-bin-linux-x64@2.2.8: The platform "win32" is incompatible with this module.
info "@expo/ngrok-bin-linux-x64@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-sunos-x64@2.2.8: The platform "win32" is incompatible with this module.
info "@expo/ngrok-bin-sunos-x64@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-win32-ia32@2.2.8-beta.1: The CPU architecture "x64" is incompatible with this module.
info "@expo/ngrok-bin-win32-ia32@2.2.8-beta.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.11: The platform "win32" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "expo-cli > @expo/xdl > @expo/webpack-config > @expo/webpack-pwa-manifest-plugin > @expo/image-utils@0.2.10" has unmet peer dependency "sharp-cli@^1.10.0".
[4/4] Building fresh packages...
success Installed "expo-cli@3.11.3" with binaries:
      - expo
      - expo-cli
Done in 857.04s.

C:\Users\Michael>expo init hcreacttest
? Choose a template: expo-template-blank
√ Please enter a few initial configuration values.
  Read more: https://docs.expo.io/versions/latest/workflow/configuration/ · 100% completed
? Yarn v1.21.1 found. Use Yarn to install dependencies? Yes
Extracting project files...
Customizing project...
Unable to initialize git repo. `git` not in PATH.
Installing dependencies...
yarn install v1.21.1
info No lockfile found.
[1/4] Resolving packages...
warning expo > fbemitter > fbjs > core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > fbjs > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > fbjs-scripts > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > metro-babel-register > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native-web > deep-assign@3.0.0: Check out `lodash.merge` or `merge-options` instead.
[2/4] Fetching packages...
info fsevents@1.2.11: The platform "win32" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 504.35s.

Your project is ready at C:\Users\Michael\hcreacttest

To get started, you can type:

  cd hcreacttest
  yarn start


C:\Users\Michael>cd hcreacttest

C:\Users\Michael\hcreacttest>yarn start
yarn run v1.21.1
$ expo start
Starting project at C:\Users\Michael\hcreacttest
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class. Run CLI with --verbose flag for more details.

SyntaxError: Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class
    at new RegExp (<anonymous>)
    at blacklist (C:\Users\Michael\hcreacttest\node_modules\metro-config\src\defaults\blacklist.js:34:10)
    at getBlacklistRE (C:\Users\Michael\hcreacttest\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:66:59)
    at getDefaultConfig (C:\Users\Michael\hcreacttest\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:82:20)
    at load (C:\Users\Michael\hcreacttest\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:118:25)
    at Object.runServer [as func] (C:\Users\Michael\hcreacttest\node_modules\@react-native-community\cli\build\commands\server\runServer.js:82:58)
    at Command.handleAction (C:\Users\Michael\hcreacttest\node_modules\@react-native-community\cli\build\index.js:164:23)
    at Command.listener (C:\Users\Michael\hcreacttest\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:210:5)
    at Command.parseArgs (C:\Users\Michael\hcreacttest\node_modules\commander\index.js:651:12)
Metro Bundler process exited with code 1
Set EXPO_DEBUG=true in your env to view the stack trace.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

C:\Users\Michael\hcreacttest>

error_expocli3113hcreacttest

Environment

C:\Users\Michael\hcreacttest>expo diagnostics
[19:24:51] Generating diagnostics report...
[19:24:51] You can join our slack here: https://slack.expo.io/.

Expo CLI 3.11.3 environment info:
System:
OS: Windows 10
Binaries:
Yarn: 1.21.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD

Diagnostics report:
[19:25:54] API Response Error: Not logged in.

Reproducible Demo

"yarn global add expo-cli"
"expo init hcreacttest"
"cd appname"
"yarn start"

@Shair17
Copy link

Shair17 commented Jan 4, 2020

Go node_modules/metro-config/defaults/backlist.js

and replace this line:

var sharedBlacklist = [
  /node_modules[/\\]react[/\\]dist[/\\].*/,
  /website\/node_modules\/.*/,
  /heapCapture\/bundle\.js/,
  /.*\/__tests__\/.*/
];

to this:

var sharedBlacklist = [
  /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
  /website\/node_modules\/.*/,
  /heapCapture\/bundle\.js/,
  /.*\/__tests__\/.*/
];

@Kramraes1
Copy link
Author

@Shair17 I don't have a node_modules/metro-config/defaults?
Only node_modules/metro-config/node_modules
node_modules/metro-config/src
node_modules/metro-config/packages.json
node_modules/metro-config/README.md

@Shair17
Copy link

Shair17 commented Jan 4, 2020

Make sure you have a correct package.json, then run npm install, then do that i've comment before.

@Kramraes1
Copy link
Author

@Shair17
Thank you, I found it in the src folder!

But now I get a new error:

C:\Users\Michael\hcreacttest>yarn start
yarn run v1.21.1
$ expo start
There is a new version of expo-cli available (3.11.3).
You are currently using expo-cli 2.5.0
Run npm install -g expo-cli to get the latest version
[20:03:19] Starting project at C:\Users\Michael\hcreacttest
[20:03:34] Expo DevTools is running at http://localhost:19002
[20:03:34] Opening DevTools in the browser... (press shift-d to disable)
[20:04:40] Could not access packager status at http://127.0.0.1:19001/status. Are you sure the packager is running and reachable?
[20:04:40] Set EXPO_DEBUG=true in your env to view the stack trace.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

error2

@Kramraes1
Copy link
Author

Kramraes1 commented Jan 4, 2020

Make sure you have a correct package.json, then run npm install, then do that i've comment before.

@Shair17 I don't know how to make sure I have the correct package.json??

@Shair17
Copy link

Shair17 commented Jan 5, 2020

@Kramraes1 run npm install -g expo-cli with git bash. then verify your package.json of your project folder if all dependencies are there.

@ccheever
Copy link
Contributor

ccheever commented Jan 6, 2020

Hi--

Sorry you ran into this. It looks like this has been fixed by @fson in this change to metro-config facebook/metro#468 but it might take a little bit of time for this fix to get put into a RN release and make its way into Expo.

In the short term, at a galnce without having tested it myself, the comment above describes a reasonable way to manually patch your installation.

Closing this for now since this is already fixed upstream.

@ccheever ccheever closed this as completed Jan 6, 2020
@Kramraes1
Copy link
Author

@ccheever So, what am I supposed to do now?
I don't know what this reply means:

@Kramraes1 run npm install -g expo-cli with git bash. then verify your package.json of your project folder if all dependencies are there.

How do I verify my package.json, and how do I know that all the dependencies are there?

I found the src folder and changed the "sharedBlacklist" but I get a new error now:

Thank you, I found it in the src folder!
But now I get a new error:

C:\Users\Michael\hcreacttest>yarn start
yarn run v1.21.1
$ expo start
There is a new version of expo-cli available (3.11.3).
You are currently using expo-cli 2.5.0
Run npm install -g expo-cli to get the latest version
[20:03:19] Starting project at C:\Users\Michael\hcreacttest
[20:03:34] Expo DevTools is running at http://localhost:19002
[20:03:34] Opening DevTools in the browser... (press shift-d to disable)
[20:04:40] Could not access packager status at http://127.0.0.1:19001/status. Are you sure the packager is running and reachable?
[20:04:40] Set EXPO_DEBUG=true in your env to view the stack trace.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

error2

@AsadAftab-Nust
Copy link

\node_modules\metro-config\src\defaults\blacklist.js
This is the path.......... But the problem still exists

@brentvatne
Copy link
Member

@AsadAftab-Nust - on sdk38 or what? we need more information

@brentvatne
Copy link
Member

brentvatne commented Jul 3, 2020

@AsadAftab-Nust and @Kramraes1 - make sure you're using the latest version of expo-cli please. npm i -g expo-cli

@byCedric
Copy link
Member

byCedric commented Jul 3, 2020

Hi people, to give a bit more context when this was fixed and why it still pops up:

Now, this issue is also related to certain Node 12.x.x versions (as described in the PR from @fson) and makes it even harder to reproduce. If it works for you without Ville's fix, it's most likely related to a patched Node version.

What can you do if this happens to you?
Try doing any of these steps, updating your node or sdk might already fix this.

  • I would recommend using the latest Node version available, right now it's either node 12.18.2 or 14.5.0 (see node releases).
  • Use SDK 38, which uses React Native 0.62 with the updated packages (metro and rnc/cli)
  • Manually patch the blacklist (see comment)

If that fails, check which versions of metro you are using with npm list metro or yarn list metro and open a new issue with your environment. I'd be happy to check it out further.

Hope this helps!

@Gtstride
Copy link

Gtstride commented Dec 3, 2020

Thanks @Shair17,

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants