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.

ERROR: Unable to resolve module path | ReactNative TS Template | Apple Silicone (M1)

See original GitHub issue

The error is started when I am adding the below code. My Repo: https://github.com/ImAbhishekTomar/RNRazorpay

import dotenv from 'dotenv';
dotenv.config();

OR

const dotenv = require('dotenv');

Development Info

react-native-cli: 2.0.1 react-native: 0.66.3 “@types/dotenv”: “^8.2.0”, “dotenv”: “^10.0.0”,

Error

error: Error: Unable to resolve module path from /Users/abhishektomar/Desktop/root/apps/RNRazorpay/node_modules/dotenv/lib/main.js: path could not be found within the project or in these directories:
  node_modules
  ../node_modules

If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
  10 |
  11 | type DotenvConfigOptions = {
> 12 |   path?: string, // path to .env file
     |                     ^
  13 |   encoding?: string, // encoding of .env file
  14 |   debug?: string // turn on logging for debugging purposes
  15 | }
    at ModuleResolver.resolveDependency (/Users/abhishektomar/Desktop/root/apps/RNRazorpay/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:129:15)
  at DependencyGraph.resolveDependency (/Users/abhishektomar/Desktop/root/apps/RNRazorpay/node_modules/metro/src/node-haste/DependencyGraph.js:288:43)
  at Object.resolve (/Users/abhishektomar/Desktop/root/apps/RNRazorpay/node_modules/metro/src/lib/transformHelpers.js:129:24)
  at resolve (/Users/abhishektomar/Desktop/root/apps/RNRazorpay/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33)
  at /Users/abhishektomar/Desktop/root/apps/RNRazorpay/node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26
  at Array.reduce (<anonymous>)
  at resolveDependencies (/Users/abhishektomar/Desktop/root/apps/RNRazorpay/node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33)
  at processModule (/Users/abhishektomar/Desktop/root/apps/RNRazorpay/node_modules/metro/src/DeltaBundler/traverseDependencies.js:140:31)
  at async addDependency (/Users/abhishektomar/Desktop/root/apps/RNRazorpay/node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18)
  at async Promise.all (index 1)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
motdotlacommented, Jan 16, 2022

Putting this on our todo list. It would be nice if it supported react native out of the box.

1reaction
ImAbhishekTomarcommented, Dec 18, 2021

Alert: M1 is not ready for react developer, using for last 2 months and having a lot of issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Unable to resolve module path" in React Native
The error message: Unable to resolve module path. Should really be: Unable to resolve module "path". path is the name of the module...
Read more >
Fails for react-native app · Issue #268 · motdotla/dotenv
It failed because React Native does not include the Node standard library ... ERROR: Unable to resolve module path | ReactNative TS Template...
Read more >
Could not find module for target 'x86_64-apple-ios-simulator'
Today I solved this error on our app for library 'CodableWrappers' and this solved my problem: close XCode; open Finder app and show...
Read more >
How to import files from outside of root directory with React ...
error : bundling failed: Error: Unable to resolve module `../. ... Since we have mapped common key to common/ path, we can include...
Read more >
ERROR: Unable to resolve module path | ReactNative TS ...
ERROR : Unable to resolve module path | ReactNative TS Template | Apple Silicone (M1) #574. The error is started when I am...
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