简体   繁体   English

在项目或这些目录 node_modules/ethereumjs-wallet/node_modules 中找不到加密

[英]crypto could not be found within the project or in these directories node_modules/ethereumjs-wallet/node_modules

I am getting this error我收到此错误

[Error: undefined Unable to resolve module crypto from /pathToProject/node_modules/ethereumjs-wallet/dist.browser/index.js: crypto could not be found within the project or in these directories: node_modules/ethereumjs-wallet/node_modules node_modules [错误:未定义无法从 /pathToProject/node_modules/ethereumjs-wallet/dist.browser/index.js 解析模块加密:在项目或这些目录中找不到加密:node_modules/ethereumjs-wallet/node_modules node_modules

  71 | Object.defineProperty(exports, "__esModule", { value: true });
  72 | exports.thirdparty = exports.hdkey = void 0;
> 73 | var crypto = __importStar(require("crypto"));
     |                                    ^
  74 | var ethereumjs_util_1 = require("ethereumjs-util");
  75 | var scrypt_js_1 = require("scrypt-js");

Some related dependencies :一些相关的依赖:

    "@ethersproject/shims": "^5.6.0",
    "@metamask/controllers": "^30.0.0",
    "crypto-js": "3.3.0",
    "eth-keyring-controller": "^7.0.2",
    "ethers": "^5.6.4",
    "react-native-aes-crypto": "^2.1.0",
    "react-native-crypto": "2.1.2",

I am trying to use KeyringController from here and other controllers defined by MetaMask from here我正在尝试从这里使用 KeyringController 以及从这里使用 MetaMask 定义的其他控制器

Module crypto is not part of react-native runtime by default.默认情况下,模块crypto不是 react-native 运行时的一部分。

You might need to follow the https://www.npmjs.com/package/react-native-crypto#install to set up the shim.您可能需要按照https://www.npmjs.com/package/react-native-crypto#install来设置 shim。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM