React-native: it did not contain a package, nor an index file

Created on 15 Jul 2017  路  14Comments  路  Source: facebook/react-native

Is this a bug report?

(write your answer here)

Have you read the Bugs section of the Contributing to React Native Guide?

(Write your answer here.)

Environment

  1. react-native -v: 0.46.1
  2. node -v:v6.10.3
  3. npm -v:3.10.10
  4. yarn --version (if you use Yarn):v0.24.5

Then, specify:

  • Target Platform: Android

  • Development Operating System: Windows10

  • Build tools:

Steps to Reproduce

(Write your steps here:)

1.react-native start
2.err shows up: bundling failed: "Unable to resolve module ./img/tabbar/[email protected] from F:\\code\\react-native\\meituanCopy\\src\\RootScene.js: could not resolve `F:\code\react-native\meituanCopy\src\img\tabbar\[email protected]' as a folder: it did not contain a package, nor an index file"
3.just using source={require('../img/tabbar/[email protected]')} /> and the png is existed

Expected Behavior

Actual Behavior

in v0.44.0 react-native , the code runs well..but when i copy the code to a new demo. the err shows...

Reproducible Demo

Locked

Most helpful comment

I was able to fix this by changing my file names to ones without any @

All 14 comments

I have the same problem the code was working correctly in 0.45.1 now i updated version and the images cannot load Icon-83.[email protected]' as a folder: it did not contain a package, nor an index file

@hramos any resolution for this, or another issue that addresses it? Thanks!

I was able to fix this by changing my file names to ones without any @

Hey, thanks for reporting this issue!

It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the template? This is necessary for people to be able to understand and reproduce the issue being reported.

@nemophrost I think this fixes it for me too but then it would break React Native's static image functionality? https://facebook.github.io/react-native/docs/images.html#static-image-resources

Is this a bug report?

Yes

Have you read the Bugs section of the How to Contribute guide?

Yes

Environment

react-native -v: 0.46.1
node -v: v7.7.2
npm -v: 4.1.2
yarn --version: 0.24.6
expo: v19.0.0

Then, specify:

Target Platform: iOS
Development Operating System: MacOS 10.12.5
Build tools: Expo
Steps to Reproduce

{
  "presets": ["babel-preset-expo"],
  "env": {
    "development": {
      "plugins": ["transform-react-jsx-source"]
    }
  },
  "sourceMaps": true // https://marketplace.visualstudio.com/items?itemName=vsmobile.vscode-react-native
}

Errors on @2x and @3x, but when I take out the @ it works fine

require("./assets/images/placeholders/icon-image.png"),
      require('./assets/images/placeholders/[email protected]'),
      require("./assets/images/placeholders/[email protected]"),
require("./assets/images/placeholders/icon-image.png"),
      require('./assets/images/placeholders/icon-image2x.png'),
      require("./assets/images/placeholders/icon-image3x.png"),

Expected Behavior

Runs fine on Expo v18 (rn v0.45.1)

Actual Behavior

simulator screen shot 23 jul 2017 19 48 11

@henrypip Yeah it could break static image stuff. In my case I was only using @2x without the others and using its path explicitly. Perhaps the bug would also be fixed if I wasn't explicitly referring to @2x and referred to a file without the density suffix, but I haven't tried it.

any facebook offical solution for this issue? @hramos

I have not looked into this since the issue was closed. I recommend opening a new issue (and following the template).

@hramos have you see this? https://github.com/facebook/react-native/issues/15030#issuecomment-317273562 (I think that the template is following)
Why not simple reopen this issue instead of opening new one ??

I've created a ticket for this issue against the metro-bundler project 馃憠 https://github.com/facebook/metro-bundler/issues/43

I have got the same error.
The solution in my case:
import path was wrong, after fixing import from exact path problem resolved.

dont support png u should transform jpg

@sytolk there's hundreds of comments across issues and PRs on this repo every day, it's easy for things to slip by. Still, I highly recommend opening a new issue that meets the guidelines - the author still hasn't updated their original post, and the comment with the additional details was not from the OP. A new issue would make things easier for everyone.

Was this page helpful?
0 / 5 - 0 ratings