Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Unable to resolve module crypto in Node backend

Open
#899 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, node.js, react-native

Research direction

Start by reproducing the Metro resolution failure from the provided React Native application using Node 16.15.1. Inspect jsonwebtoken/verify.js at the crypto import and the Metro ModuleResolution.js stack shown in the report. Done means establishing whether this Node backend usage is supported and documenting a confirmed resolution or limitation.

Written by the indexing model from the issue text.

Description

Description

I'm trying to use the sign function in my NodeJS backend of my React Native application.

Reproduction

I have the following code:
image

and it's throwing me the following error:
`Error: Unable to resolve module crypto from /Users/{username}/Documents/Projets/app/server/node_modules/jsonwebtoken/verify.js: crypto could not be found within the project or in these directories:
server/node_modules/jsonwebtoken/node_modules
server/node_modules
node_modules
7 | const PS_SUPPORTED = require('./lib/psSupported');
8 | const jws = require('jws');

9 | const {KeyObject, createSecretKey, createPublicKey} = require("crypto");
| ^
10 |
11 | const PUB_KEY_ALGS = ['RS256', 'RS384', 'RS512'];
12 | const EC_KEY_ALGS = ['ES256', 'ES384', 'ES512'];
at ModuleResolver.resolveDependency (/Users/{username}/Documents/Projets/app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:162:15)
at DependencyGraph.resolveDependency (/Users/{username}/Documents/Projets/app/node_modules/metro/src/node-haste/DependencyGraph.js:260:43)
at Object.resolve (/Users/{username}/Documents/Projets/app/node_modules/metro/src/lib/transformHelpers.js:177:21)
at Graph._resolveDependencies (/Users/{username}/Documents/Projets/app/node_modules/metro/src/DeltaBundler/Graph.js:432:35)
at Graph._processModule (/Users/{username}/Documents/Projets/app/node_modules/metro/src/DeltaBundler/Graph.js:218:38)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Graph._addDependency (/Users/{username}/Documents/Projets/app/node_modules/metro/src/DeltaBundler/Graph.js:314:20)
at async Promise.all (index 0)
at async Graph._processModule (/Users/{username}/Documents/Projets/app/node_modules/metro/src/DeltaBundler/Graph.js:263:5)`

Environment

Please provide the following:
image

My version of Node is 16.15.1

Dominant language
JavaScript
Stars
18.2k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from auth0/node-jsonwebtoken

All issues in auth0/node-jsonwebtoken

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.