简体   繁体   English

导入 Node 标准库模块“crypto”时出错

[英]Error importing the Node standard library module “crypto”

When I attempt to compile my app, I get the attached error despite the fact that I am not explicitly attempting to import crypto in any of the files I have written myself.当我尝试编译我的应用程序时,我收到附加错误,尽管我没有明确尝试在我自己编写的任何文件中导入加密。 It seems that it is imported in a file automatically present in the node_modules folder.似乎它是在 node_modules 文件夹中自动存在的文件中导入的。 Is anyone familiar with the given error?有人熟悉给定的错误吗? error错误

The package at "node_modules\reques\lib\helpers.js" attempted to import the Node standard library module "crypto". It failed because the native React runtime does not include the Node standard library. Read more at https://docs.expo.io/introduction/faq/#can-i-use-nodejs-packages-with-expo

You can't use the request package, it included native Node.js libraries that are not supported in React Native.您不能使用请求 package,它包含 React Native 不支持的本机 Node.js 库。 Use another request library that is made for React native.使用为 React native 制作的另一个请求库。

This is because a dependency in your react-native project is using the crypto library.这是因为 react-native 项目中的依赖项正在使用加密库。

One of the dependencies installed is not made for react-native and is made to run on the server.安装的依赖项之一不是为 react-native 制作的,而是在服务器上运行的。 Find out which dependency that is and you can change it to a react-native compatible library to fix the issue.找出是哪个依赖项,您可以将其更改为 react-native 兼容库来解决问题。

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

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