Ошибка не может разрешить модуль "crypto" при создании адреса кошелька - PullRequest
0 голосов
/ 12 июня 2019

Я пытаюсь создать кошелек для хранения только что созданной монеты на платформе wave.

Metro Bundler обнаружил внутреннюю ошибку, пожалуйста, проверьте вывод ошибок терминала для получения более подробной информации. При попытке разрешить модуль crypto из файла C:\Users\El\.expo\bandzWallet\node_modules\@waves\waves-crypto\random.js, пакет C:\Users\El\.expo\bandzWallet\node_modules\crypto\package.json был успешно найден.Однако сам этот пакет указывает поле модуля main, которое не может быть разрешено (C:\Users\El\.expo\bandzWallet\node_modules\crypto\index.js. Действительно, ни один из этих файлов не существует:

  • C:\Users\El\.expo\bandzWallet\node_modules\crypto\index.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
  • C:\Users\El\.expo\bandzWallet\node_modules\crypto\index.js\index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx) Не удалось построить пакет JavaScript. Невозможно прочитать свойство 'status' из неопределенного

    "использовать строгий"; Object.defineProperty (exports, "__esModule", {value: true}); const random = (count) => {if (isBrowser) {const arr = new Uint8Array (count); const crypto = (global.crypto || global.msCrypto); crypto.getRandomValues ​​(arr); вернуть arr;} const crypto = require ('crypto'); вернуть Uint8Array.from (crypto.randomBytes (count));}; const sureBuffer = () => {try {const b = new Buffer (1);} catch (e) {throw new Error (' Buffer notподдерживается в этой среде. Используйте Node.js или Browserify для поддержки браузера. ');}}; const isBrowser = typeof window! ==' undefined '&& ({}). toString.call (window) ===' [objectОкно] '; exports.secureRandom = (count, type) => {switch (type) {case' Array8 ': вернуть Array.from (random (c)р а ф));case 'Array16': вернуть Array.from (exports.secureRandom (count, 'Uint16Array'));case 'Array32': вернуть Array.from (exports.secureRandom (count, 'Uint32Array'));case 'Buffer': sureBuffer ();return Buffer.from (random (count));case 'Uint8Array': вернуть случайное число (число);case 'Uint16Array': вернуть новый Uint16Array (count) .map (_ => random (2) .reduce ((a, b, i) => a | b << 8 * (1 - i), 0));case 'Uint32Array': вернуть новый Uint32Array (count) .map (_ => random (4) .reduce ((a, b, i) => a | b << 8 * (1 - i), 0));по умолчанию: выбросить новую ошибку (тип + 'не поддерживается.');}};// # sourceMappingURL = random.js.map </p>

Я пытаюсь использовать @ waves / waves-crypto для создания аддера кошелька и начального числа в тестовой сети.

Я использую React Native и Expo cli

...