Molunerfinn / PicGo

:rocket:A simple & beautiful tool for pictures uploading built by vue-cli-electron-builder
https://molunerfinn.com/PicGo/
MIT License
24.21k stars 2.24k forks source link

[Bug]: 无法安装插件,检测不到已安装的nodejs和npm #1266

Closed SlenderData closed 4 months ago

SlenderData commented 4 months ago

前置阅读 | Pre-reading

PicGo的版本 | PicGo Version

v2.4.0-beta.8

系统信息 | System Information

Windows

问题重现 | Bug reproduce

Nodejs 版本 v20.15.1,使用包管理器 fnm 安装。

image

image

终端的默认配置文件 Microsoft.PowerShell_profile.ps1 里按照 fnm 的指导添加了如下代码。如果不添加,Windows 终端同样也检测不到已安装的 Nodejs。

fnm env --use-on-cd | Out-String | Invoke-Expression

相关日志 | Logs

2024-07-18 08:59:40 [PicGo INFO] [PicGo Server] is listening at 36677 2024-07-18 08:59:40 [PicGo INFO] register builtin shortKey command: [picgo:upload] - [CommandOrControl+Shift+P] 2024-07-18 08:59:40 [PicGo INFO] register builtin shortKey command: [picgo:upload] - [CommandOrControl+Shift+P] successfully 2024-07-19 08:40:35 [PicGo INFO] [PicGo Server] is listening at 36677 2024-07-19 08:40:35 [PicGo INFO] register builtin shortKey command: [picgo:upload] - [CommandOrControl+Shift+P] 2024-07-19 08:40:35 [PicGo INFO] register builtin shortKey command: [picgo:upload] - [CommandOrControl+Shift+P] successfully 2024-07-19 08:41:43 [PicGo ERROR] ------Error Stack Begin------ Error: spawn npm ENOENT at notFoundError (C:\Program Files\PicGo\resources\app.asar\node_modules\picgo\node_modules\cross-spawn\lib\enoent.js:6:26) at verifyENOENT (C:\Program Files\PicGo\resources\app.asar\node_modules\picgo\node_modules\cross-spawn\lib\enoent.js:40:16) at ChildProcess.cp.emit (C:\Program Files\PicGo\resources\app.asar\node_modules\picgo\node_modules\cross-spawn\lib\enoent.js:27:25) at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) -------Error Stack End------- 2024-07-19 08:41:43 [PicGo ERROR] NPM is not installed 2024-07-19 08:41:43 [PicGo ERROR] 插件安装失败,失败码为1,错误日志为 'npm' �����ڲ����ⲿ���Ҳ���ǿ����еij��� ���������ļ���

Molunerfinn commented 4 months ago

这个 npm 和 node.js 需要你的环境变量的 PATH 里有对应的路径,否则 picgo 将无法找到。具体可以谷歌。