【问题标题】:ocean protocol react tutorial npm start fails海洋协议反应教程 npm 启动失败
【发布时间】:2020-12-03 00:17:17
【问题描述】:

我只是想克隆这个 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

我在解开问题的根本原因方面运气不佳,感谢您提供任何帮助!

【问题讨论】:

    标签: javascript reactjs webpack create-react-app


    【解决方案1】:

    看起来本教程使用的包现在已删除。 (Squid.js)

    关于为什么它给出TypeError 因为whatwg-url 是squid.js 的依赖包,而whatwg-url 期待一个对象并且它接收未定义或空值。可能是 squid.js 在内部调用了一些外部 url/api 来创建实例。

    而不是使用:

    import { Ocean } from '@oceanprotocol/squid'.

    使用这个:

    react-tutorial repo 未更新支持 V3 版本的 Ocean 协议:https://github.com/oceanprotocol/react-tutorial/issues/14

    import { Ocean } from '@oceanprotocol/react'

    NPM:npm install @oceanprotocol/reacthttps://www.npmjs.com/package/@oceanprotocol/react

    Github 文档:https://github.com/oceanprotocol/ocean.js

    希望这会有所帮助!干杯。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-11
    • 2020-11-28
    • 2018-03-26
    • 2023-03-04
    • 2019-09-29
    • 1970-01-01
    相关资源
    最近更新 更多