使用 tossr 路由 SSR 问题: throw new ERR_INVALID_ARG_TYPE('target', ['Buffer', 'Uint8Array'], target);

问题描述

我正在使用 Routify 框架构建一个网站。 在 yarn run serve 时,在 yarn run build 之后,我收到错误消息。

node:buffer:202
    throw new ERR_INVALID_ARG_TYPE('target',['Buffer','Uint8Array'],target);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "target" argument must be an instance of Buffer or Uint8Array. Received null
    at new NodeError (node:internal/errors:329:5)
    at _copy (node:buffer:202:11)
    at Buffer.copy (node:buffer:776:12)
    at Request.<anonymous> (/Users/SEOngto/devs/front-end/f14-allius-public-routify/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:864:11)
    at Request.emit (node:events:378:20)
    at Gunzip.<anonymous> (/Users/SEOngto/devs/front-end/f14-allius-public-routify/node_modules/request/request.js:1073:12)
    at Gunzip.emit (node:events:378:20)
    at addChunk (node:internal/streams/readable:313:12)
    at readableAddChunk (node:internal/streams/readable:288:9)
    at Gunzip.Readable.push (node:internal/streams/readable:227:10) {
  code: 'ERR_INVALID_ARG_TYPE'
}

那是什么?有什么解决办法吗?

运行yarn run dev时不会出现问题

以下是我的 package.json 脚本。

"scripts": {
    "dev": "run-p routify nollup","dev:ssr": "run-p routify rollup","build": "run-s build:*","build:app": "routify -b && rollup -c","build:static": "spank","serve": "spassr --ssr","rollup": "rollup -cw","nollup": "nollup -c","routify": "routify"

附言我想做的是SSR。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)