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

cannot reslove node:process React-native metro-resolver.js #19269

Closed
1 of 4 tasks
RavikanthOB opened this issue Sep 21, 2023 · 6 comments
Closed
1 of 4 tasks

cannot reslove node:process React-native metro-resolver.js #19269

RavikanthOB opened this issue Sep 21, 2023 · 6 comments

Comments

@RavikanthOB
Copy link

Current Behavior

Im using Axios in React native project under nx repo .Im facing bellow issue

Metro has encountered an error: Cannot resolve node:process: /Users/Learn/learn-app/node_modules/@nx/react-native/plugins/metro-resolver.js (30:15)

28 | return resolvedPath;
29 | }

30 | throw new Error(Cannot resolve ${chalk.bold(realModuleName)});
| ^
31 | };
32 | }
33 | exports.getResolveRequest = getResolveRequest;

RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_drain
_dispatch_main_queue_callback_4CF
CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
main
start_sim
0x0
0x0

Expected Behavior

Need a document or steps to use external lib like got ,axios etc

GitHub Repo

No response

Steps to Reproduce

1.Create a Nx react-navtive porject
2. Add install axios
3. Create instanse of axios
4. Call any method

Nx Report

error: Error: Cannot resolve url
    at  /Users/Learn/learn-app/node_modules/@nx/react-native/plugins/metro-resolver.js:30:15
    at Object.resolve ( /Users/Learn/learn-app/node_modules/metro-resolver/src/resolve.js:47:12)
    at ModuleResolver.resolveDependency (  /Users/Learn/learn-app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:79:31)
    at DependencyGraph.resolveDependency ( /Users/Learn/learn-app/node_modules/metro/src/node-haste/DependencyGraph.js:277:43)
    at Object.resolve ( /Users/Learn/learn-app/node_modules/metro/src/lib/transformHelpers.js:169:21)
    at Graph._resolveDependencies ( /Users/Learn/learn-app/node_modules/metro/src/DeltaBundler/Graph.js:473:35)
    at Graph._processModule ( /Users/Learn/learn-app/node_modules/metro/src/DeltaBundler/Graph.js:261:38)
    at async Graph._addDependency ( /Users/Learn/learn-app/node_modules/metro/src/DeltaBundler/Graph.js:372:20)
    at async Promise.all (index 1)
    at async Graph._processModule ( /Users/Learn/learn-app/node_modules/metro/src/DeltaBundler/Graph.js:322:5)
 ERROR  [Error: InternalError Metro has encountered an error: Cannot resolve url:  /Users/Learn/learn-app/node_modules/@nx/react-native/plugins/metro-resolver.js (30:15)
  28 |             return resolvedPath;
  29 |         }
> 30 |         throw new Error(`Cannot resolve ${chalk.bold(realModuleName)}`);
     |               ^
  31 |     };
  32 | }

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@AgentEnder
Copy link
Member

What's nx report say?

@airowe
Copy link

airowe commented Sep 22, 2023

For what it's worth, I'm seeing the same issue when trying to import from an internal lib package in a monorepo setup that was working prior to this upgrade. @AgentEnder, here's the output of my nx report:

Node   : 18.16.1
   OS     : darwin-arm64
   npm    : 9.5.1

   nx                 : 16.8.1
   @nx/js             : 16.8.1
   @nx/jest           : 16.8.1
   @nx/linter         : 16.8.1
   @nx/workspace      : 16.8.1
   @nx/cypress        : 16.8.1
   @nx/detox          : 16.8.1
   @nx/devkit         : 16.8.1
   @nx/eslint-plugin  : 16.8.1
   @nx/react          : 16.8.1
   @nx/react-native   : 16.8.1
   @nrwl/tao          : 16.8.1
   @nx/web            : 16.8.1
   @nx/webpack        : 16.8.1
   typescript         : 5.2.2

@alexbalda
Copy link

Facing the same issue here. Blocking me from upgrading RN deps. Is this being looked into, please?

@xiongemi
Copy link
Collaborator

xiongemi commented Oct 3, 2023

i think it is related to this issue: facebook/react-native#38025

just comment out the line unstable_enablePackageExports: true, in metro.config.js should reolve this.

@xiongemi
Copy link
Collaborator

xiongemi commented Oct 4, 2023

closing out this issue for now.

@xiongemi xiongemi closed this as completed Oct 5, 2023
Copy link

github-actions bot commented Nov 5, 2023

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants