首页 > 解决方案 > Uncaught (in promise) TypeError: Object prototype may only be an Object or null: undefined

问题描述

我想将文件上传到实体容器。

我以这段代码为例。 https://github.com/jeff-zucker/solid-file-client/blob/master/docs/node-upload.md

不同之处在于我solid-auth-fetcher用于授权。代码看起来像这样

const auth = require('solid-auth-cli')
const fc = new SolidFileClient(auth)
await fc.copyFile("file:///home/m0nte-cr1st0/fasf.jpg", "https://dimadmytruk23.inrupt.net/fasf.jpg" )

用户在文件上传时已经登录。

但是,我收到以下错误。

polyfills.js:139 Uncaught (in promise) TypeError: Object prototype may only be an Object or null: undefined
    at Function.setPrototypeOf (<anonymous>)
    at polyfills.js:139
    at patch (polyfills.js:141)
    at patch (graceful-fs.js:104)
    at Object.<anonymous> (graceful-fs.js:96)
    at Object../node_modules/graceful-fs/graceful-fs.js (graceful-fs.js:373)
    at __webpack_require__ (bootstrap:789)
    at fn (bootstrap:150)
    at Object../node_modules/solid-rest/node_modules/fs-extra/lib/fs/index.js (index.js:5)
    at __webpack_require__ (bootstrap:789)
    at fn (bootstrap:150)
    at Object../node_modules/solid-rest/node_modules/fs-extra/lib/index.js (index.js:5)
    at __webpack_require__ (bootstrap:789)
    at fn (bootstrap:150)
    at Object.<anonymous> (file.js:4)
    at Object../node_modules/solid-rest/src/file.js (file.js:214)
    at __webpack_require__ (bootstrap:789)
    at fn (bootstrap:150)
    at setRestHandlers (index.js:10)
    at Object.fetch (index.js:33)
    at SolidFileClient.fetch (SolidApi.js:140)
    at SolidFileClient.get (SolidApi.js:155)
    at SolidFileClient.copyFile (SolidApi.js:515)
    at Transcription.tsx:53

文件在那里。路径是正确的。

标签: javascriptreactjsfilesolid

解决方案


推荐阅读