Unable to resolve module crypto in Node backend
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
- Domain
- backend, mobile-dev
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:

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:
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from auth0/node-jsonwebtoken
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
auth0/node-jsonwebtoken#1042 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
auth0/node-jsonwebtoken#1000 · 2 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 65/100
auth0/node-jsonwebtoken#1046 ·
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
auth0/node-jsonwebtoken#1034 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
auth0/node-jsonwebtoken#1032 ·
All issues in auth0/node-jsonwebtoken
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
antfu-collective/icones#398 ·
-
ECmail.com Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
wesbos/burner-email-providers#554 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
radiantearth/stac-browser#1023 ·
-
HMR stops working Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
components-web-app/docs#92 ·
