快速模块映射中不存在模块“ crypto”

问题描述

试图在React native中实现Pusher Beam,但收到以下错误

错误:捆绑失败:错误:无法解析crypto中的模块PROJECT-DIRECTORY\node_modules\@pusher\push-notifications-server\utils.js:急速模块映射中不存在模块crypto

有关此步骤https://pusher.com/tutorials/push-notifications-android

,请参阅此文档

在我的 App.js 中,我将完全相同的代码用于通知测试代码

const PushNotifications = require('@pusher/push-notifications-server');

let pushNotifications = new PushNotifications({
  instanceId: 'YOUR_INSTANCE_ID_HERE',secretKey: 'YOUR_SECRET_KEY_HERE',});

pushNotifications
  .publishToInterests(['hello'],{
    fcm: {
      notification: {
        title: 'Hello World',body: 'Hello!',},})
  .then(publishResponse => {
    console.log('Just published:',publishResponse.publishId);
  })
  .catch(error => {
    console.log('Error:',error);
  });

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)