Metro: Error: Cannot find module 'metro/src/DeltaBundler/Worker'

Created on 18 Oct 2018  ยท  16Comments  ยท  Source: facebook/metro

When I run the react-native start I am getting this error message.
I cleaned up all cache and removed node_modules/ these don't work.

Can anyone help me, please?

My versions are.

react-native -v
react-native-cli: 1.2.0
react-native: 0.57.3

All code block as below;

react-native start --reset-cache
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                                              โ”‚
โ”‚  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
   /Users/m/p/my-project

warning: the transform cache was reset.
Loading dependency graph, done.
Loading dependency graph...(node:26114) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot find module 'metro/src/DeltaBundler/Worker'
(node:26114) [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.

Most helpful comment

@soranoba didn't work for me either.
@aafarian I think there's an issue with the version of metro packaged with the latest RN Upgrade.
I just installed locally in dev metro npm install --save-dev metro, which is the version 0.51.1, and that worked for me.

All 16 comments

Having the same issue.. :/

FYI: I also encountered the same issue, but I solved it.

rm -rf $TMPDIR/metro-cache*
watchman watch-del-all
react-native start --reset-cache

@soranoba I've tried that, didn't work for me

I got this error to go away by uninstalling metro and installing metro-config. Not sure if it will work in everyone's case.

@soranoba didn't work for me either.
@aafarian I think there's an issue with the version of metro packaged with the latest RN Upgrade.
I just installed locally in dev metro npm install --save-dev metro, which is the version 0.51.1, and that worked for me.

@cladjules After about an hour of searching, your comment solved my issue. Thanks! (Upgrading to RN 0.59)

I have also experienced this error when upgrading to react-native 0.59.0. Oddly enough, I didn't run into this error when using yarn. When I tried fresh with npm instead it gave the same issue others have had here. I tried to use metro: 0.53.0 (current latest stable), but it instead produced new errors around "Module scheduler does not exist in the Haste module map" and multiple attempts to clear watchman, metro and haste caches, and new npm i with no node modules all didn't work. Running watchman watch-list only ever listed my RN project as the only root. Another oddity was that running npm i a second time yielded a different message that didn't appear the first time:

npm WARN [email protected] requires a peer of jest-haste-map@^24.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of jest-haste-map@^24.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of jest-haste-map@^24.0.0 but none is installed. You must install peer dependencies yourself.

I also tried it with metro 0.51.1 as that seemed to work for others and still got an error with the scheduler not existing in the Haste module map. When I dev installed scheduler (^0.13.4) it worked. I then tried it again with the scheduler still in the devDependencies on .13.4 and with metro on .53.0 and it also loaded without error on iOS.

delete yarn log and yarn again

This did not worked for me.

react-native-cli: 2.0.1
react-native: 0.60.0

FYI: I also encountered the same issue, but I solved it.

rm -rf $TMPDIR/metro-cache*
watchman watch-del-all
react-native start --reset-cache

The issue was fixed only I did those steps:

https://github.com/facebook/react-native/issues/23908#issuecomment-486977922

reinstalling metro solved my problem:

npm install --save-dev metro

reinstalling metro solved my problem:

npm install --save-dev metro

thanks you saved me

@soranoba didn't work for me either.
@aafarian I think there's an issue with the version of metro packaged with the latest RN Upgrade.
I just installed locally in dev metro npm install --save-dev metro, which is the version 0.51.1, and that worked for me.

Thank you so much! This one worked.

reinstalling metro solved my problem:

npm install --save-dev metro

Saved my life, Thanks

If you are using Yarn
try this <3
yarn add --dev metro metro-core

@soranoba didn't work for me either.
@aafarian I think there's an issue with the version of metro packaged with the latest RN Upgrade.
I just installed locally in dev metro npm install --save-dev metro, which is the version 0.51.1, and that worked for me.

It worked for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IljaDaderko picture IljaDaderko  ยท  5Comments

Naturalclar picture Naturalclar  ยท  4Comments

peterp picture peterp  ยท  3Comments

vtn-dev2016 picture vtn-dev2016  ยท  4Comments

torkelrogstad picture torkelrogstad  ยท  4Comments