y***@qq.com
y***@qq.com
  • 发布:2025-04-28 18:07
  • 更新:2025-04-28 19:09
  • 阅读:208

客户端如何用npm 第三方库@coze/api/ws-tools

分类:uni-app

安装coze 库没有报错 npm install @coze/api --save

在云对象中也能使用,但是在客户端报错,

1、用 import { WsToolsUtils } from "@coze/api/ws-tools"; 页面报如下错误。

Failed to resolve import "@coze/api/ws-tools" from "C:/Users/123/Documents/HBuilderProjects/hr/pages/index/websocketRtc.vue". Does the file exist?

2、用const { WsToolsUtils } = require('@coze/api/ws-tools'); 报如下错误:

main.js?t=1745834743272:27 ReferenceError: require is not defined

2025-04-28 18:07 负责人:无 分享
已邀请:
y***@qq.com

y***@qq.com (作者)

不好意思,是我自己的问题,uni-app 新手,新装库,需要重启服务,重启就好了。

DCloud_UNI_JBB

DCloud_UNI_JBB

要回复问题请先登录注册