海洋协议反应教程 npm 启动失败
ocean protocol react tutorial npm start fails
我只是想克隆这个 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
期待一个对象并且它接收未定义或 null。可能是 squid.js 内部调用一些外部 url/api 来创建实例。
而不是使用:
import { Ocean } from '@oceanprotocol/squid'
.
使用这个:
react-tutorial repo 尚未更新以支持海洋协议的 V3 版本:https://github.com/oceanprotocol/react-tutorial/issues/14
import { Ocean } from '@oceanprotocol/react'
NPM : npm install @oceanprotocol/react
https://www.npmjs.com/package/@oceanprotocol/react
Github 文档:https://github.com/oceanprotocol/ocean.js
希望对您有所帮助!!干杯。
我只是想克隆这个 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
期待一个对象并且它接收未定义或 null。可能是 squid.js 内部调用一些外部 url/api 来创建实例。
而不是使用:
import { Ocean } from '@oceanprotocol/squid'
.
使用这个:
react-tutorial repo 尚未更新以支持海洋协议的 V3 版本:https://github.com/oceanprotocol/react-tutorial/issues/14
import { Ocean } from '@oceanprotocol/react'
NPM : npm install @oceanprotocol/react
https://www.npmjs.com/package/@oceanprotocol/react
Github 文档:https://github.com/oceanprotocol/ocean.js
希望对您有所帮助!!干杯。