gpt4 book ai didi

javascript - 海洋协议(protocol) react 教程 npm 启动失败

转载 作者:行者123 更新时间:2023-12-03 18:59:56 28 4
gpt4 key购买 nike

我只是想克隆这个 repo:https://github.com/oceanprotocol/react-tutorial
当我运行应用程序时,我得到以下堆栈跟踪:

Uncaught TypeError: Cannot convert undefined or null to object
at Function.getPrototypeOf (<anonymous>)
at Object../node_modules/whatwg-url/dist/utils.js (utils.js:48)
at __webpack_require__ (bootstrap:784)
at fn (bootstrap:150)
at Object../node_modules/whatwg-url/dist/URL.js (URL.js:4)
at __webpack_require__ (bootstrap:784)
at fn (bootstrap:150)
at Object../node_modules/whatwg-url/webidl2js-wrapper.js (webidl2js-wrapper.js:3)
at __webpack_require__ (bootstrap:784)
at fn (bootstrap:150)
at Object../node_modules/whatwg-url/index.js (index.js:3)
at __webpack_require__ (bootstrap:784)
at fn (bootstrap:150)
at Object../node_modules/@oceanprotocol/squid/dist/node/aquarius/Aquarius.js (Aquarius.ts:1)
at __webpack_require__ (bootstrap:784)
at fn (bootstrap:150)
at Object../node_modules/@oceanprotocol/squid/dist/node/ocean/Ocean.js (Ocean.ts:11)
at __webpack_require__ (bootstrap:784)
at fn (bootstrap:150)
at Object../node_modules/@oceanprotocol/squid/dist/node/squid.js (squid.ts:4)
at __webpack_require__ (bootstrap:784)
at fn (bootstrap:150)
at Module../src/index.js (asset.js:54)
at __webpack_require__ (bootstrap:784)
at fn (bootstrap:150)
at Object.1 (index.js:126)
at __webpack_require__ (bootstrap:784)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at main.chunk.js:1
我在解开问题的根本原因方面运气不佳,感谢您提供任何帮助!

最佳答案

看起来本教程使用的包现在已删除。 (Squid.js)
以及为什么给予TypeError因为whatwg-url是 squid.js 和 whatwg-url 的依赖包期待一个对象及其接收未定义或空值。可能是 squid.js 在内部调用了一些外部 url/api 来创建实例。
而不是使用:import { Ocean } from '@oceanprotocol/squid' .
用这个 :
react-tutorial repo 尚未更新以支持 V3 版本的海洋协议(protocol):https://github.com/oceanprotocol/react-tutorial/issues/14import { Ocean } from '@oceanprotocol/react'NPM : npm install @oceanprotocol/react https://www.npmjs.com/package/@oceanprotocol/react
Github 文档:https://github.com/oceanprotocol/ocean.js
希望这可以帮助 !!干杯。

关于javascript - 海洋协议(protocol) react 教程 npm 启动失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65118070/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com