question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to resolve module `./theme/components`

See original GitHub issue

react-native, react and native-base version

“native-base”: “^2.4.0”, “react”: “16.2.0”, “react-native”: “0.53.3”,

Expected behaviour

expected to work

Actual behaviour

npm install on my project, react-native link and then run the project to see this error…

App throws a red screen with the error


error: bundling failed: Error: Unable to resolve module `./theme/components` from `/Users/bhakta/dev/react-native/astro/node_modules/native-base/dist/src/index.js`: The module `./theme/components` could not be found from `/Users/bhakta/dev/react-native/astro/node_modules/native-base/dist/src/index.js`. Indeed, none of these files exist:

  * `/Users/bhakta/dev/react-native/astro/node_modules/native-base/dist/src/theme/components(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`
  * `/Users/bhakta/dev/react-native/astro/node_modules/native-base/dist/src/theme/components/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`
    at ModuleResolver.resolveDependency (/Users/bhakta/dev/react-native/astro/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:311:1122)
    at ResolutionRequest.resolveDependency (/Users/bhakta/dev/react-native/astro/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:96:16)

Steps to reproduce (code snippet or screenshot)

+ native-base@2.4.0
updated 1 package in 7.48s
bhakta@Bhaktas-MacBook-Pro:~/dev/react-native/astro$
bhakta@Bhaktas-MacBook-Pro:~/dev/react-native/astro$
bhakta@Bhaktas-MacBook-Pro:~/dev/react-native/astro$ cd node_modules/native-base/src
bhakta@Bhaktas-MacBook-Pro:~/dev/react-native/astro/node_modules/native-base/src$ ll
total 16
-rw-r--r--   1 bhakta  staff   221 Mar 27 11:41 init.js
-rw-r--r--   1 bhakta  staff  3273 Mar 27 11:41 index.js
drwxr-xr-x  56 bhakta  staff  1792 Mar 27 12:33 basic
drwxr-xr-x   3 bhakta  staff    96 Mar 27 12:33 theme
drwxr-xr-x   6 bhakta  staff   192 Mar 27 12:33 Utils
bhakta@Bhaktas-MacBook-Pro:~/dev/react-native/astro/node_modules/native-base/src$ head index.js
import { StyleProvider, connectStyle } from "native-base-shoutem-theme";
import { keys } from "lodash";
import { Col, Row, Grid } from "react-native-easy-grid";
// import { Gravatar } from "./basic/Gravatar";
import setDefaultThemeStyle from "./init";
import getTheme from "./theme/components";
import variables from "./theme/variables/platform";
import Drawer from "./basic/Drawer";
import { SwipeRow } from "./basic/SwipeRow";
import { Text } from "./basic/Text";
bhakta@Bhaktas-MacBook-Pro:~/dev/react-native/astro/node_modules/native-base/src$ ls ./theme/
variables

I don’t see components?

Screenshot of emulator/device

error: bundling failed: Error: Unable to resolve module ./theme/components from /Users/bhakta/dev/react-native/astro/node_modules/native-base/dist/src/index.js: The module ./theme/components could not be found from /Users/bhakta/dev/react-native/astro/node_modules/native-base/dist/src/index.js. Indeed, none of these files exist:

  • /Users/bhakta/dev/react-native/astro/node_modules/native-base/dist/src/theme/components(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)
  • /Users/bhakta/dev/react-native/astro/node_modules/native-base/dist/src/theme/components/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json) at ModuleResolver.resolveDependency (/Users/bhakta/dev/react-native/astro/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:311:1122) at ResolutionRequest.resolveDependency (/Users/bhakta/dev/react-native/astro/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:96:16) at DependencyGraph.resolveDependency (/Users/bhakta/dev/react-native/astro/node_modules/metro/src/node-haste/DependencyGraph.js:269:4352) at /Users/bhakta/dev/react-native/astro/node_modules/metro/src/DeltaBundler/traverseDependencies.js:201:36 at Generator.next (<anonymous>) at step (/Users/bhakta/dev/react-native/astro/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:306) at /Users/bhakta/dev/react-native/astro/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:536 at new Promise (<anonymous>) at /Users/bhakta/dev/react-native/astro/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:217 at addDependency (/Users/bhakta/dev/react-native/astro/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:92) BUNDLE [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓░░░░░░ 66.2% (656/806), failed.

Is the bug present in both ios and android or in any one of them?

Any other additional info which would help us debug the issue quicker.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

0reactions
zimportantcommented, Apr 28, 2018

I fixed it by navigating to react-base-theme/ then sudo chmod 755 -R *

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to Resolve module in react-native - Stack Overflow
if you want to import getTheme using this way, ./native-base-theme/components you have to put index file in your components folder.
Read more >
React Native, Typescript and VS Code: Unable to resolve ...
The problem with resolving modules turned out to be related to VS Code's typescript project helper.
Read more >
Error: Unable to resolve module `util` – Split Help Center
Running bundle using React Native and Javascript SDK causes an error. Bundling failed: Error: Unable to resolve module `util`.
Read more >
Troubleshooting | React Navigation
I'm getting an error "Unable to resolve module" after updating to the latest version​. This might happen for 3 reasons: Stale cache of...
Read more >
[RESOLVED] Unable to resolve module
Hi All. I was looking for a "get location and display on map" component and found one. Link to the post in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found