React-native: [0.60.x] `warnOnce` error in new 0.60.x project created with react-native-cli

Created on 9 Jul 2019  路  9Comments  路  Source: facebook/react-native

React Native version:

$ react-native info
info Fetching system and libraries information...
System:
    OS: Linux 4.18 Ubuntu 18.04.2 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 1.58 GB / 15.39 GB
    Shell: 4.4.19 - /bin/bash
  Binaries:
    Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
    Yarn: 1.16.0 - /usr/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.0 => 0.60.0

Steps To Reproduce

  1. yarn global add react-native-cli
  2. react-native init testproject --version 0.60.0
  3. cd testproject && react-native run-android
  4. Project builds, but bundler doesn't stay open
BUILD SUCCESSFUL in 7s
27 actionable tasks: 26 executed, 1 up-to-date
info Connecting to the development server...
info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.testproject/.MainActivity }
user@computer:~/Documents/testproject$ 
  1. yarn run metro build index.js -O index.android.bundle
  2. 6.
Error: Unable to resolve module `warnOnce` from `/home/rob/Documents/testproject/node_modules/react-native/Libraries/react-native/react-native-implementation.js`: Module `warnOnce` 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-*`.

Describe what you expected to happen:
Project builds without error

Snack, code example, or link to a repository:

Bug Linux Stale 馃捇CLI

Most helpful comment

I start facing this issue after upgrading form RN 60.4 to 61.1.
My workaround is to change metro.config.js to look like this
UPDATE same with RN 0.61.2

const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {
  resolver: {
    blacklistRE: blacklist([
      /node_modules\/.*\/node_modules\/react-native\/.*/,
    ])
  },
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
};

if you getclient.send error try to add metro yarn add metro

All 9 comments

This is a known issue when using haste

https://github.com/facebook/react-native/issues/24479
https://github.com/facebook/react-native/issues/24065
https://github.com/facebook/react-native/issues/23943

I believe it is already solved on master since it is no longer using haste and will probably be out in next patch or v0.61

You can try solutions in linked issues meanwhile, but I came across similar issue, cleared all these caches and had no luck 馃槖

Any fix for this?
react-native 0.60.4

Still an issue for us on 0.60.4

is this problem just exit in windows? I fonund my project run with macOS is ok,but in the windows it still happen

@Docwzm having this issue in macOS

Any update on this?

I start facing this issue after upgrading form RN 60.4 to 61.1.
My workaround is to change metro.config.js to look like this
UPDATE same with RN 0.61.2

const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {
  resolver: {
    blacklistRE: blacklist([
      /node_modules\/.*\/node_modules\/react-native\/.*/,
    ])
  },
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
};

if you getclient.send error try to add metro yarn add metro

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings