cosmos / cosmjs

The Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers.
https://cosmos.github.io/cosmjs/
Apache License 2.0
655 stars 344 forks source link

React Native Expo build error #1583

Open forbesus opened 7 months ago

forbesus commented 7 months ago

Hello everyone I am getting above error


node_modules/@cosmjs/proto-signing/node_modules
node_modules
  33 | async function getCryptoModule() {
  34 |     try {
> 35 |         const crypto = await Promise.resolve().then(() => __importStar(require("crypto")));
    |                                                                                 ^
  36 |         // We get `Object{default: Object{}}` as a fallback when using
  37 |         // `crypto: false` in Webpack 5, which we interprete as unavailable.
  38 |         if (typeof crypto === "object" && Object.keys(crypto).length <= 1) {
Error: Unable to resolve module crypto from /home/expo/workingdir/build/node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/pbkdf2.js: crypto could not be found within the project or in these directories:
  node_modules/@cosmjs/proto-signing/node_modules
  node_modules
  33 | async function getCryptoModule() {
  34 |     try {
> 35 |         const crypto = await Promise.resolve().then(() => __importStar(require("crypto")));
     |                                                                                 ^
  36 |         // We get `Object{default: Object{}}` as a fallback when using
  37 |         // `crypto: false` in Webpack 5, which we interprete as unavailable.
  38 |         if (typeof crypto === "object" && Object.keys(crypto).length <= 1) {
    at ModuleResolver.resolveDependency (/home/expo/workingdir/build/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:138:15)
    at DependencyGraph.resolveDependency (/home/expo/workingdir/build/node_modules/metro/src/node-haste/DependencyGraph.js:231:43)
    at /home/expo/workingdir/build/node_modules/metro/src/lib/transformHelpers.js:156:21
    at resolveDependencies (/home/expo/workingdir/build/node_modules/metro/src/DeltaBundler/buildSubgraph.js:42:25)
    at visit (/home/expo/workingdir/build/node_modules/metro/src/DeltaBundler/buildSubgraph.js:83:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 4)
at async visit (/home/expo/workingdir/build/node_modules/metro/src/DeltaBundler/buildSubgraph.js:92:5)
    at async Promise.all (index 0)
    at async visit (/home/expo/workingdir/build/node_modules/metro/src/DeltaBundler/buildSubgraph.js:92:5)```