Skip to content

Unable to resolve module with react-native 0.57 #21922

@pronebird

Description

@pronebird

Environment

React-native CLI is running at:  /Users/pronebird/app/

  React Native Environment Info:
    System:
      OS: macOS 10.14
      CPU: x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
      Memory: 27.06 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.12.0 - /usr/local/Cellar/node/10.12.0/bin/node
      Yarn: 1.10.1 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
    IDEs:
      Xcode: 10.0/10A255 - /usr/bin/xcodebuild

Description

Looking for JS files in
   /Users/pronebird/app/packages/mobile
   /Users/pronebird/app/packages/mobile/node_modules
   /Users/pronebird/app/node_modules
   /Users/pronebird/app/packages/components 

Loading dependency graph, done.
 BUNDLE  [ios, dev] ../../packages/mobile/index.js ▓▓▓▓░░░░░░░░░░░░ 26.1% (329/6
44)::1 - - [24/Oct/2018:11:46:54 +0000] "GET /index.bundle?platform=ios&dev=trueerror: bundling failed: Error: Unable to resolve module `scheduler/tracing` from `/Users/pronebird/app/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-dev.js`: Module `scheduler/tracing` does not exist in the Haste module map

Config:

const path = require('path');

console.log('React-native CLI is running at: ', __dirname);

module.exports = {
  projectRoot: path.resolve(__dirname, 'packages/mobile'),
  watchFolders: [
    path.resolve(__dirname, 'packages/mobile/node_modules'),
    path.resolve(__dirname, 'node_modules'),
    path.resolve(__dirname, 'packages/components/'),
  ]
}

Running with:

yarn workspace mobile-app ios

which basically runs:

react-native run-ios --simulator

The config from v0.56 which worked!:

const path = require('path');

console.log('React-native CLI is running at: ', __dirname);

module.exports = {
  getProjectRoots() {
    return [
      path.resolve(__dirname, 'packages/mobile'),
      path.resolve(__dirname, 'packages/components/'),
      path.resolve(__dirname, 'packages/mobile/node_modules'),
      path.resolve(__dirname, 'node_modules'),
    ];
  }
}

Because yarn and react-native are both buggy I also symlink node_modules/react-native -> packages/mobile/node_modules/react-native to make that work together.

Reproducible Demo

Let us know how to reproduce the issue. Include a code sample, share a project, or share an app that reproduces the issue using https://snack.expo.io/. Please follow the guidelines for providing a MCVE: https://stackoverflow.com/help/mcve

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: LockedThis issue was locked by the bot.Tech: Bundler 📦This issue is related to the bundler (Metro, Haul, etc) used.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions