Forge Design Automation Revit教程错误
我正在尝试设计自动化教程进行修订。 我遇到以下错误。 有人可以帮助我解决此错误。
TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of ReadStream
at new NodeError (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\lib\internal\errors.js:372:5)
at write_ (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\lib\_http_outgoing.js:742:11)
at ClientRequest.end (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\lib\_http_outgoing.js:855:5)
at Request._end (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\node_modules\superagent\lib\node\index.js:1282:9)
at Request.end (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\node_modules\superagent\lib\node\index.js:1000:8)
at c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\node_modules\superagent\lib\request-base.js:282:12
at new Promise (<anonymous>)
at RequestBase.then (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\node_modules\superagent\lib\request-base.js:264:31)
at c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\node_modules\forge-apis\src\ApiClient.js:394:7
at processTicksAndRejections (node:internal/process/task_queues:96:5) {code: 'ERR_INVALID_ARG_TYPE', statusCode: undefined, stack: 'TypeError [ERR_INVALID_ARG_TYPE]: The "chunk"…ions (node:internal/process/task_queues:96:5)', message: 'The "chunk" argument must be of type string …nt8Array. Received an instance of ReadStream', toString: ƒ, …}
I am trying the Design Automation Tutorial for Revit.
I am getting the following error.
Can someone help me fix this error.
TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of ReadStream
at new NodeError (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\lib\internal\errors.js:372:5)
at write_ (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\lib\_http_outgoing.js:742:11)
at ClientRequest.end (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\lib\_http_outgoing.js:855:5)
at Request._end (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\node_modules\superagent\lib\node\index.js:1282:9)
at Request.end (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\node_modules\superagent\lib\node\index.js:1000:8)
at c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\node_modules\superagent\lib\request-base.js:282:12
at new Promise (<anonymous>)
at RequestBase.then (c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\node_modules\superagent\lib\request-base.js:264:31)
at c:\Users\roshan.kerketta\Desktop\Digital\Forge\ModelDesignAutomation\SampleDesignAutomation\node_modules\forge-apis\src\ApiClient.js:394:7
at processTicksAndRejections (node:internal/process/task_queues:96:5) {code: 'ERR_INVALID_ARG_TYPE', statusCode: undefined, stack: 'TypeError [ERR_INVALID_ARG_TYPE]: The "chunk"…ions (node:internal/process/task_queues:96:5)', message: 'The "chunk" argument must be of type string …nt8Array. Received an instance of ReadStream', toString: ƒ, …}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
感谢拉胡尔发现这个问题!我可以重现@johnkuldeeproshankerketta在0.9.0中以Forge SDK(Forge-apis)经历的内容。根据错误的提示,我更新了教程代码(第509,510行)使用readfile而不是文件流。现在,它可以与0.9.0合作。
我发布了教程的问题
https://github.com/autodesk-forge/learn.forge。 DesignAutomation/Essue/31
Thanks Rahul for spotting the issue! I can reproduce what @JohnKuldeepRoshanKerketta experienced in Forge SDK (forge-apis) in 0.9.0. By the hint of error, I updated the tutorial code(line 509,510) to use readFile, instead of file stream. Now it works well with 0.9.0.
I posted the Issue with tutorial
https://github.com/Autodesk-Forge/learn.forge.designautomation/issues/31
如果您的目标是了解此特定错误,那么您可以阅读此问题/答案最好/解释。但是,由于这来自Forge的
nodejs
apis,因此我认为您没有编写此代码,因此您不应该关注它。我最好的猜测是,您已经设法升级了
nodejs
packageforge-api
0.9.0
和其他教程repo/code的其余部分与它不兼容。您可以使用以下命令进行检查:您应该查看以下结果:
如果您的
forge-apis
正在显示0.9.0
而不是0.8.6
0.8.6 ,然后说明您遇到的错误。要降级它,您可以删除node_modules
文件夹,请删除对package.json.json
和/或package> package> package-lock.json
的任何更改,然后运行npm安装
。另外,您也可以明确降级
forge-api
模块。If your goal is to understand this specific error, then you can read this question/answer where it is best asked/explained. However since this is coming from Forge's
nodejs
apis, I think you did not write this code and you should not be concerned with it.My best guess is you have somehow managed to upgrade the
nodejs
packageforge-api
to0.9.0
and the rest of the tutorial repo/code is not compatible with it. You can check this with the following command:You should see the following result:
If your
forge-apis
is showing0.9.0
instead of0.8.6
, then it explains the error you have. To downgrade it, you can either delete yournode_modules
folder, undo any changes topackage.json
and/orpackage-lock.json
and runnpm install
again.Alternatively you can also explicitly downgrade the
forge-api
module.