React Native - Unable to resolve module for Android on Windows machines
See original GitHub issueCurrent Behavior
My co-workers and I are all getting this issue only on Windows machines when starting the Android app. It seems there was an existing issue for this that was closed as completed https://github.com/nrwl/nx-react-native/issues/23 but now appears to be back.
error: ReferenceError: SHA-1 for file D:\Business\Development\Code\node_modules\rxjs\dist\cjs\internal\observable.js (D:\Business\Development\Code\node_modules\rxjs\dist\cjs\inter
nal\observable.js) is not computed.
Potential causes:
1) You have symlinks in your project - watchman does not follow symlinks.
2) Check `blockList` in your metro.config.js and make sure it isn't excluding the file path.
at DependencyGraph.getSha1 (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\node-haste\DependencyGraph.js:191:13)
at Transformer.transformFile (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\Transformer.js:104:23)
at Bundler.transformFile (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\Bundler.js:57:30)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.transform (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\lib\transformHelpers.js:101:12)
at async processModule (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:137:18)
at async addDependency (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:230:18)
at async Promise.all (index 1)
at async processModule (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:198:5)
at async addDependency (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:230:18)
info Reloading app...
BUNDLE src/main.tsx
error: Error: Unable to resolve module ../Observable from D:\Business\Development\Code\node_modules\rxjs\dist\cjs\internal\observable\ConnectableObservable.js: ../Observable could not be found with
in the project or in these directories:
node_modules
17 | Object.defineProperty(exports, "__esModule", { value: true });
18 | exports.ConnectableObservable = void 0;
> 19 | var Observable_1 = require("../Observable");
| ^
20 | var Subscription_1 = require("../Subscription");
21 | var refCount_1 = require("../operators/refCount");
22 | var OperatorSubscriber_1 = require("../operators/OperatorSubscriber");
at ModuleResolver.resolveDependency (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:158
:15)
at DependencyGraph.resolveDependency (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\node-haste\DependencyGraph.js:231:43)
at Object.resolve (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\lib\transformHelpers.js:129:24)
at resolve (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:33)
at D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:412:26
at Array.reduce (<anonymous>)
at resolveDependencies (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:411:33)
at processModule (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:140:31)
at async addDependency (D:\Business\Development\Code\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:230:18)
at async Promise.all (index 1)
Steps to Reproduce
Seems to be caused by the rxjs library
Environment
Node : 16.14.2
OS : win32 x64
yarn : 1.22.18
nx : 14.4.2
react-native: 0.68.2
@react-native-community/cli: 7.0.3
@react-native-community/cli-debugger-ui: 7.0.3
@react-native-community/cli-platform-android: 7.0.1
@react-native-community/cli-platform-ios: 7.0.1
metro: 0.71.2
metro-core: 0.71.2
metro-react-native-babel-preset: 0.71.2
metro-resolver: 0.71.2
@nrwl/cypress : 14.4.2
@nrwl/detox : 14.4.2
@nrwl/devkit : 14.4.2
@nrwl/eslint-plugin-nx : 14.4.2
@nrwl/express : 14.4.2
@nrwl/jest : 14.4.2
@nrwl/js : 14.4.2
@nrwl/linter : 14.4.2
@nrwl/next : 14.4.2
@nrwl/node : 14.4.2
@nrwl/nx-cloud : 14.0.8
@nrwl/react : 14.4.2
@nrwl/react-native : 14.4.2
@nrwl/storybook : 14.4.2
@nrwl/web : 14.4.2
@nrwl/workspace : 14.4.2
typescript : 4.7.4
---------------------------------------
Community plugins:
@simondotm/nx-firebase: 0.3.3
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:8 (2 by maintainers)
Top Results From Across the Web
React Native error 'Unable to resolve module `react-native` '
All these commands are windows specific. There will be android folder in your project directory, go to that folder and open command prompt...
Read more >unable to resolve module assets react native - You.com
Solution - just a workaround… · Click "Reset content and settings…" in the simulator's drop down menu and confirm · Close the simulator...
Read more >react-native-device-info - npm
Linking in native modules is a frequent source of trouble for new react-native developers, resulting in errors like "RNDeviceInfo is null" ...
Read more >r/reactnative - Reddit
error: Error: Unable to resolve module ./App from C:\Users\15124\thisoneforreal\index.js: None of these files exist: * App(.native|.android.
Read more >Troubleshooting - React Native
If you run into issue where executing npm run android on macOS throws the above error, try to run sudo chmod +x android/gradlew...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey all, I’m having this issue with a project created using
@nrwl/expo:app
too.I’m also using rxjs in my project.
I have a Nx library that depends on rxjs. I can replicate this consistently on a new project by using my Nx library project with rxjs in the new RN project.
This issue has been automatically marked as stale because it hasn’t had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏