expo / examples

Example projects that demonstrate how to use Expo APIs and integrate Expo with other popular tools
2.21k stars 862 forks source link

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

Open Prismoid opened 1 year ago

Prismoid commented 1 year ago

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):

Smartphone (please complete the following information):

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.