Twilio React Native - 无法解析模块加密 [英] Twilio React Native - Unable to resolve module crypto

查看:79
本文介绍了Twilio React Native - 无法解析模块加密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 twilio 包实现到我的 react-native 项目中,当我在我的文件中需要它时,该项目不会加载,我看到以下错误:

I'm working on implementing the twilio package into my react-native project and when I require it in my file the project wont load and I'm seeing the following error:

无法从/Users/[myname]/Documents/Projects/React-Native/[app-name]/node_modules/twilio/lib/webhooks.js 解析模块加密:无法在其模块映射或/Users/node_modules/crypto 下的任何 node_modules 目录及其父目录

我试过直接安装 crypto 包,但似乎也不起作用.

I've tried installing the crypto package directly and that doesn't seem to work either.

有没有人遇到过这个问题,有办法解决吗?

Has anyone experienced this issue, and has a way to resolve it?

推荐答案

React Native 似乎不接受基于依赖项的某些包,Twilio 就是其中之一.

It seems that React Native doesn't accept certain packages based on their dependencies, Twilio being one of these.

虽然不是直接的解决方案,但我通过创建一个单独的 Express 服务器来进行 Twilio 调用,并从我的 React Native 应用程序中调用该路由,从而解决了这个问题.

While not a direct solution, I created a work around to this issue by creating a separate Express server to make the Twilio call, and calling that route from within my React Native app.

这篇关于Twilio React Native - 无法解析模块加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆