Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jamesone opened this issue Jul 31, 2017 · 2 comments
Closed

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

jamesone opened this issue Jul 31, 2017 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jamesone
Copy link

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?

@RyanMitchellWilson
Copy link

I had similar issues trying to upgrade, removing the @2x from the imports seemed to do the trick.

@jamesone
Copy link
Author

jamesone commented Aug 7, 2017

@RyanMitchellWilson Can confirm that this worked! 😄

@jamesone jamesone closed this as completed Aug 7, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Aug 7, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants