React-native: After upgrading to [email protected]: Module `PickerIOS` does not exist in the Haste module map

Created on 25 Apr 2018  路  17Comments  路  Source: facebook/react-native

I upgraded react-native from version 0.54.2 to latest 0.55.3.
After that when i run react-native run-ios i get the following from the Metro bundler:

error: bundling failed: Error: Unable to resolve module `PickerIOS` from `/Users/sebbe/code/pitchler-app/node_modules/react-native/Libraries/react-native/react-native-implementation.js`: Module `PickerIOS` does not exist in the Haste module map

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
  1. Clear watchman watches: `watchman watch-del-all`.
  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
  3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.
    at ModuleResolver.resolveDependency (/Users/sebbe/code/pitchler-app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:161:1460)
    at ResolutionRequest.resolveDependency (/Users/sebbe/code/pitchler-app/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:91:16)
    at DependencyGraph.resolveDependency (/Users/sebbe/code/pitchler-app/node_modules/metro/src/node-haste/DependencyGraph.js:272:4579)
    at dependencies.map.relativePath (/Users/sebbe/code/pitchler-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:376:19)
    at Array.map (<anonymous>)
    at resolveDependencies (/Users/sebbe/code/pitchler-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:374:16)
    at /Users/sebbe/code/pitchler-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:212:33
    at Generator.next (<anonymous>)
    at step (/Users/sebbe/code/pitchler-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:313)
    at /Users/sebbe/code/pitchler-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:473

I tried following the steps in the output: clear watchman watches, delete node_modules and the Metro Bundler cache but it did not work.

I removed node_modules and clear caches again. After that i installed the previous version i had of react-native again (0.54.2) and ran react-native run-ios again and it worked just fine.

Environment

Environment:
OS: macOS High Sierra 10.13.4
Node: 9.5.0
Yarn: 1.5.1
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.3 Build version 9E145
Android Studio: 3.1 AI-173.4697961

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.3 => 0.55.3

Steps to Reproduce

Using react-native 55.3, try including PickerIOS and use it in the code. Then try to build it using react-native run-ios

Expected Behavior

The Metro Bundler should not give any errors and build the app.

Actual Behavior

The Metro Bundler terminal window gave me the error stated above.

iOS Locked

Most helpful comment

Ran into this also, I had to use yarn start --reset-cache when running the bundler till it actually cleared that error for me

All 17 comments

Ran into this also, I had to use yarn start --reset-cache when running the bundler till it actually cleared that error for me

Same here. @Slessi 's solution didn't work:

Not working on 0.55.4 either

+1 Any solutions yet?

I have same problem! any solutions ?

Working on 0.55.4

  • yarn start --reset-cache or npm start --reset-cache
  • and press or execute 'Reload JS'
  • wait until load at 100%

This above solution by @EdgarXolop does not work for me either. I am on exactly the same stack as @Spetastian.

Edit: it actually worked for me with the yarn command, but not with the npm command. Shouldn't that be the same?

@klapperkopp cool but should be the same, I'm working with npm 5.6.0. Maybe is the npm version. What is your current version?

PD: If someone has the same problem maybe can be a possible solution.

I'm using npm 5.6.0 and just hit the same issue with RN 0.55.2. Upgrading to 0.55.4 and clearing everything with watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache fixed it for me.

on the same versions as @dchersey and this fix worked for me.

@EdgarXolop yes might be that. I'm also on npm 5.6.0.
I also tried the same as @dchersey before, but that didn't work out for me. With yarn no problems though.

$TMPDIR/react-* in @dchersey's answer didn't work for me, but then that folder, nor my /tmp folder, had any react files in it that I could see.

Removing that part of the line worked fine.

@StrictlySkyler Which part of the line?

@srameshr rm -rf $TMPDIR/react-* && was what I removed, so it looked like:

watchman watch-del-all && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache

Its working on 0.55.4 but in case of any error I have to clear the cache again and reload JS. Anybody has solution to this?

@dchersey solution works for 0.55.2 , if you are using yarn instead of npm use yarn --reset-cache

Closing since errors like ModuleXXdoes not exist in the Haste module map are fixable via a variation of the solution proposed here:

Was this page helpful?
0 / 5 - 0 ratings