[Question] 依赖问题
WyInnovate opened this issue · comments
斓曦未央丶 commented
🧐 问题描述 | Proposed Solution
求助,遇到如下报错
Error: Invalid environment; fetch is not defined
at new ChatGPTAPI (file:///C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/node_modules/chatgpt/build/index.js:174:13)
等等
📝 补充信息 | Additional Information
没查到怎么解决这个问题,希望大佬不要打我emmm
CanisMinor commented
重新全局安装下,升级到最新的包 v1.1.1,昨天有个版本依赖有问题,如果还是同样报错请留言 😝
Saber斓曦 commented
环境说明
笔记本电脑、系统:win11专业版22621.1702、openai key已设置、使用默认openai地址、git仓库为本地服务器自建gitlab
操作说明
重新安装
npm install -g @lobehub/commit-cli
使用
- 在D:\Git项目\lobe目录cmd
- git add .
- lobe
- 选择Use AI Commit
- 报错,报错内容如下:
D:\Git项目\lobe>lobe
Generating...
Error: Invalid environment; fetch is not defined
at new ChatGPTAPI (file:///C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/node_modules/chatgpt/build/index.js:174:13)
at M (file:///C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/dist/cli.js:3:862)
at file:///C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/dist/cli.js:3:2438
at commitHookEffectListMount (C:\Users\***\AppData\Roaming\npm\node_modules\@lobehub\commit-cli\node_modules\react-reconciler\cjs\react-reconciler.development.js:14778:26)
at commitPassiveMountOnFiber (C:\Users\***\AppData\Roaming\npm\node_modules\@lobehub\commit-cli\node_modules\react-reconciler\cjs\react-reconciler.development.js:16609:11)
at commitPassiveMountEffects_complete (C:\Users\***\AppData\Roaming\npm\node_modules\@lobehub\commit-cli\node_modules\react-reconciler\cjs\react-reconciler.development.js:16569:9)
at commitPassiveMountEffects_begin (C:\Users\***\AppData\Roaming\npm\node_modules\@lobehub\commit-cli\node_modules\react-reconciler\cjs\react-reconciler.development.js:16556:7)
at commitPassiveMountEffects (C:\Users\***\AppData\Roaming\npm\node_modules\@lobehub\commit-cli\node_modules\react-reconciler\cjs\react-reconciler.development.js:16544:3)
at flushPassiveEffectsImpl (C:\Users\***\AppData\Roaming\npm\node_modules\@lobehub\commit-cli\node_modules\react-reconciler\cjs\react-reconciler.development.js:19182:3)
at flushPassiveEffects (C:\Users\***\AppData\Roaming\npm\node_modules\@lobehub\commit-cli\node_modules\react-reconciler\cjs\react-reconciler.development.js:19127:14)
其他问题
- 选择 📝 docs - Add or update README and documentation
- 输入all
- 输入测试
- 输入No
- 报错,报错内容:
D:\Git项目\lobe>lobe
⠋ Committing...
[main 9479ffd] 📝 docs(all): 测试 [#No]
1 file changed, 0 insertions(+), 0 deletions(-)
ERROR The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received undefined
node:internal/errors:387:5
- NodeError (node:internal/errors:387:5)
- _write (node:internal/streams/writable:314:13)
- WriteStream.Writable.write (node:internal/streams/writable:336:10)
- Ink.writeToStdout (file:///C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/node_modules/ink/build/ink.js:241:29)
- (file:///C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/dist/cli.js:3:2105)
- commitHookEffectListMount (C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/node_modules/react-reconciler/cjs/react-reconciler.development.js:14778:26)
- commitPassiveMountOnFiber (C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/node_modules/react-reconciler/cjs/react-reconciler.development.js:16609:11)
- commitPassiveMountEffects_complete (C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/node_modules/react-reconciler/cjs/react-reconciler.development.js:16569:9)
- commitPassiveMountEffects_begin (C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/node_modules/react-reconciler/cjs/react-reconciler.development.js:16556:7)
- commitPassiveMountEffects (C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/node_modules/react-reconciler/cjs/react-reconciler.development.js:16544:3)
- 查看日志,已提交到本地,未推送到仓库
CanisMinor commented
应该是 node 18 以下 fetch polyfill 问题,我把依赖添加上了,你可以更新下或者升级 node 版本试试
Saber斓曦 commented
应该是 node 18 以下 fetch polyfill 问题,我把依赖添加上了,你可以更新下或者升级 node 版本试试
已知问题情况
问题1:Error: Invalid environment; fetch is not defined
- 更新lobe-commit,问题未解决
- 升级node 版本到18.16.0,问题解决
问题2:ERROR The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received undefined
- 更新lobe-commit,问题解决
新增问题
- 更新lobe-commit后,选择 📝 docs - Add or update README and documentation,输入信息时输入英文非常卡顿、慢,并且如果删除输入的内容过快(比如按住Backspace键或者快速多次点击Backspace键),会出现多余字符h同时删除非常卡顿、慢
- 不输入OpenAI 的转发地址的话,即使笔记本电脑使用了代理软件比如v2rayN设置好api.openai.com走代理(非全局代理),也不会走代理,然后报错,报错内容应该就是指连接不上接口,报错内容如下:
TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11457:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.then.promptTokens (file:///C:/Users/***/AppData/Roaming/npm/node_modules/@lobehub/commit-cli/node_modules/chatgpt/build/index.js:298:25)
CanisMinor commented
- 如果 [3] 无法解决,我可以看看渲染性能优化的问题
- termianl 不会跟随系统代理,要单独设置,除非前置如路由侧就代理了
- windows 下如果是用原装 terminal 最好使用 windows terminal + powershell 7 内核,渲染比较好,不会出现这种重影换行
Saber斓曦 commented
- 如果 [3] 无法解决,我可以看看渲染性能优化的问题
- termianl 不会跟随系统代理,要单独设置,除非前置如路由侧就代理了
- windows 下如果是用原装 terminal 最好使用 windows terminal + powershell 7 内核,渲染比较好,不会出现这种重影换行
环境说明
windows 下:PowerShell 7.4.0-preview.3、PowerShell 7.3.4
测试情况说明
使用 windows terminal + powershell 7 内核 7.4.0-preview.3和PowerShell 7.3.4:
CanisMinor commented
2023-05-19.214037.mp4
@s544838371 增加了防抖,之前确实在长按退格时会出现卡顿,但还是无法复现重影
Saber斓曦 commented
测试情况说明
2023.5.30更新后已知问题
- 重影问题,重影出现的前提是使用hook即,lobe -i,然后git commit的时候就会出现