Skip to content

Unable to resolve module after upgrade (0.44.0 TO 0.46.3) #15284

Closed
@jamesone

Description

Is this a bug report?

Yes

Environment

  1. react-native -v: 0.1.7
  2. node -v: 6.2
  3. npm -v: 5.0.3
  4. yarn --version: 0.24.6

Then, specify:

  • Target Platform: IOS

  • Development Operating System: macOS

Steps to Reproduce

  1. Setup RN project
  2. Add folder in root (lets call it images)
  3. Inside that folder add a couple of image files (.png)
  4. Add a package.json file inside the images folder
  5. require('img/myimage.png')
{
  "name": "img",
  "version": "0.0.1"
}

Expected Behavior

I expect that the image (myimage.png) is required into the file WITHOUT any packager errors. Note: I am trying to import an image and display it in an <Image /> component

Actual Behavior

The packager throws an error (the simulator also shows a red screen):

error: bundling failed: "Unable to resolve module `img/map_pin_bubble_2_char@2x.png` from `/Users/james/plural/mobileapp/app/common/Marker.js`: Module does not exist in the module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n  1. Clear watchman watches: `watchman watch-del-all`.\n  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n  3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`."

Note: I followed the steps the packager suggested & still got the same issue.

Notes

I was thinking that maybe RN 0.46 phased out the usage of package.json creating import shortcuts? I couldn't confirm this anywhere though?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions