expo / expo/examples

Unable to resolve module crypto when using 'web3-eth-accounts'

Open
#401 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.7k
Forks
1.1k
Avg merge
11h 15m
Merged PRs (30d)
1

Description

**Describe the bug**
When importing libraries that use crypto, I see the below error report.
-> Unable to resolve module crypto...
(The detials are shown in https://dev.to/hyetigran/unable-to-resolve-module-crypto-1gek)

**To Reproduce**
Steps to reproduce the behavior:
In the current working directory,
1. expo init
2. npm install --save web3-eth-accounts

App.js
```
var Accounts = require('web3-eth-accounts');
var accounts = new Accounts('ws://localhost:8546');
accounts.create();
```

**Expected behavior**
There are no errors.

**Screenshots**
If applicable, add screenshots to help explain your problem.
The below website shows an example of the error.
https://dev.to/hyetigran/unable-to-resolve-module-crypto-1gek

**Desktop (please complete the following information):**
- OS: iOS
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
The below site insists that if you want to avoid this error, you need to eject Expo.
https://dev.to/hyetigran/unable-to-resolve-module-crypto-1gek

But, if there are some solutions, I continue to use Expo.
Thank you.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.