小编jon*_*iel的帖子

找不到 BufferedConsole 模块

我正在使用 create-react-app 在 React 应用程序中工作,在安装 react-charts-2 后突然我开始收到此错误:

./node_modules/@jest/console/build/BufferedConsole.js
Module not found: Can't resolve 'console' in '/my-app/node_modules/@jest/console/build'
Run Code Online (Sandbox Code Playgroud)

我已经尝试删除 react-charts-2 但错误仍然出现。

有什么想法吗?

节点 6.9.0

reactjs create-react-app

5
推荐指数
1
解决办法
747
查看次数

javascript Twilio 聊天 SDK 上的身份访问被禁止

我正在使用 twilio chat javascript SDK,当我尝试创建新频道并邀请用户时遇到问题。两个用户(发送者和接收者)都收到此错误:错误:身份访问被禁止

但是,如果我转到仪表板,则频道是由 2 个成员创建的。我究竟做错了什么?

PS:我正在创建 Twilio API 上列出的用户令牌,我认为令牌不会成为问题,因为消息已经发送。当我加入频道时,问题似乎发生了。

我创建频道的代码:

this.client.createChannel({
  uniqueName: roomName,
  friendlyName: 'My Channel',
  type: 'private'
}).then(channel => {
  this.channel = channel
  this.channel.join()
});
Run Code Online (Sandbox Code Playgroud)

我的邀请码只是:

this.channel.invite(user)
Run Code Online (Sandbox Code Playgroud)

并生成用户令牌:

new Fingerprint2().get(fingerprint => {
  this.fingerprint = fingerprint

  let AUTH_TOKEN = $('meta[name=csrf-token]').attr('content')

  fetch('/chat/tokens', {
    method: 'POST',
    body: JSON.stringify({
      fingerprint: fingerprint,
      authenticity_token: AUTH_TOKEN,
      email: email
    }),
    headers: {
      'X-Requested-With': 'XMLHttpRequest',
      'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content'),
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }
  }).then(result => result.json()).then(data => {
    callback({ token: data.token, username: data.username })
  })
}) …
Run Code Online (Sandbox Code Playgroud)

twilio

4
推荐指数
1
解决办法
2145
查看次数

标签 统计

create-react-app ×1

reactjs ×1

twilio ×1