無法在執行 Windows Server 2019 的 Azure VM 上安裝 n8n

我們探索了 n8n 的三種安裝方法:

  • Docker – 在執行 Windows Server 2019 Datacenter 的 Azure VM 上不受支援
  • npx – 在過去 2 天內嘗試多次但均未成功
  • npm – 也嘗試過多次但均未成功

到目前為止,所有方法都未成功。

你可能發現 Docker「不支援」的原因是 Windows Server 2019 預設使用 Windows Containers,但 n8n 需要 Linux Containers

  • 若要在 Windows Server 2019 上使用 Docker,你必須啟用 Hyper-V 角色並安裝 Docker Desktop(或設定 Docker Engine 透過 VM 執行 Linux 容器)。
  • 警告:這比直接使用 Linux VM 複雜得多,也需要更多資源。

由於你使用的是 Azure,在 Ubuntu VM 上執行 n8n 是最專業且最穩定的方法,而不是使用 Windows Server。

n8n 是為 Linux 原生設計的。在 Ubuntu VM 上,你可以使用 Docker 在 5 分鐘內將其啟動運行,並且避免所有與 Windows 相關的「C++ Build Tool」困擾。

  • Azure 設定:建立新 VM → 映像:Ubuntu 22.04 LTS
  • 安裝:只需執行 n8n 文件中的 Docker 指令。這是自託管 n8n 的業界標準。

這有幫助嗎?

@kjooleng 說中要點了!在虛擬機中建立 Ubuntu,最簡單和最乾淨的方式。

@vijaybh,上面兩個方法都不錯。為了更好地排查 npx/npm 的故障,你能分享一下你看到的確切錯誤訊息嗎?Windows Server 上的 npm 安裝經常因為缺少 C++ Build Tools(原生 node 模組需要)而失敗,這是一個不同於 Node.js 版本問題的解決方案。

執行以下命令並分享輸出結果:

node --version

npm --version

npm install -g n8n --verbose 2>&1 | Select-String "error"

這樣我們就能確切知道它在哪裡失敗,以及 Swapnil 的方法是否只需要一個額外的修復就能在你的設置上運行。

17441 error code 1

17442 error path C:\Users\admin503034741\AppData\Roaming\npm\node_modules\n8n\node_modules\sqlite3

17443 error command failed

17444 error command C:\Windows\system32\cmd.exe /d /s /c prebuild-install -r napi || node-gyp rebuild

17445 error (node:16276) [DEP0176] DeprecationWarning: fs.R_OK is deprecated, use fs.constants.R_OK instead

17445 error (Use `node --trace-deprecation …` to show where the warning was created)

17445 error prebuild-install warn install unable to get local issuer certificate

17445 error gyp info it worked if it ends with ok

17445 error gyp info using node-gyp@8.4.1

17445 error gyp info using node@24.16.0 | win32 | x64

17445 error (node:17140) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.

17445 error (Use `node --trace-deprecation …` to show where the warning was created)

17445 error (node:17140) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.

17445 error gyp ERR! find Python

17445 error gyp ERR! find Python Python is not set from command line or npm configuration

17445 error gyp ERR! find Python Python is not set from environment variable PYTHON

17445 error gyp ERR! find Python checking if “python3” can be used

17445 error gyp ERR! find Python - “python3” is not in PATH or produced an error

17445 error gyp ERR! find Python checking if “python” can be used

17445 error gyp ERR! find Python - “python” is not in PATH or produced an error

17445 error gyp ERR! find Python checking if Python is C:\Users\admin503034741\AppData\Local\Programs\Python\Python39\python.exe

17445 error gyp ERR! find Python - “C:\Users\admin503034741\AppData\Local\Programs\Python\Python39\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe

17445 error gyp ERR! find Python - “C:\Program Files\Python39\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Users\admin503034741\AppData\Local\Programs\Python\Python39-32\python.exe

17445 error gyp ERR! find Python - “C:\Users\admin503034741\AppData\Local\Programs\Python\Python39-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe

17445 error gyp ERR! find Python - “C:\Program Files\Python39-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe

17445 error gyp ERR! find Python - “C:\Program Files (x86)\Python39-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Users\admin503034741\AppData\Local\Programs\Python\Python38\python.exe

17445 error gyp ERR! find Python - “C:\Users\admin503034741\AppData\Local\Programs\Python\Python38\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe

17445 error gyp ERR! find Python - “C:\Program Files\Python38\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Users\admin503034741\AppData\Local\Programs\Python\Python38-32\python.exe

17445 error gyp ERR! find Python - “C:\Users\admin503034741\AppData\Local\Programs\Python\Python38-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe

17445 error gyp ERR! find Python - “C:\Program Files\Python38-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe

17445 error gyp ERR! find Python - “C:\Program Files (x86)\Python38-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Users\admin503034741\AppData\Local\Programs\Python\Python37\python.exe

17445 error gyp ERR! find Python - “C:\Users\admin503034741\AppData\Local\Programs\Python\Python37\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exe

17445 error gyp ERR! find Python - “C:\Program Files\Python37\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Users\admin503034741\AppData\Local\Programs\Python\Python37-32\python.exe

17445 error gyp ERR! find Python - “C:\Users\admin503034741\AppData\Local\Programs\Python\Python37-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exe

17445 error gyp ERR! find Python - “C:\Program Files\Python37-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exe

17445 error gyp ERR! find Python - “C:\Program Files (x86)\Python37-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Users\admin503034741\AppData\Local\Programs\Python\Python36\python.exe

17445 error gyp ERR! find Python - “C:\Users\admin503034741\AppData\Local\Programs\Python\Python36\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files\Python36\python.exe

17445 error gyp ERR! find Python - “C:\Program Files\Python36\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Users\admin503034741\AppData\Local\Programs\Python\Python36-32\python.exe

17445 error gyp ERR! find Python - “C:\Users\admin503034741\AppData\Local\Programs\Python\Python36-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exe

17445 error gyp ERR! find Python - “C:\Program Files\Python36-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exe

17445 error gyp ERR! find Python - “C:\Program Files (x86)\Python36-32\python.exe” could not be run

17445 error gyp ERR! find Python checking if the py launcher can be used to find Python 3

17445 error gyp ERR! find Python - “py.exe” is not in PATH or produced an error

17445 error gyp ERR! find Python

17445 error gyp ERR! find Python **********************************************************

17445 error gyp ERR! find Python You need to install the latest version of Python.

17445 error gyp ERR! find Python Node-gyp should be able to find and use Python. If not,

17445 error gyp ERR! find Python you can try one of the following options:

17445 error gyp ERR! find Python - Use the switch --python=“C:\Path\To\python.exe”

17445 error gyp ERR! find Python (accepted by both node-gyp and npm)

17445 error gyp ERR! find Python - Set the environment variable PYTHON

17445 error gyp ERR! find Python - Set the npm configuration variable python:

17445 error gyp ERR! find Python npm config set python “C:\Path\To\python.exe”

17445 error gyp ERR! find Python For more information consult the documentation at:

17445 error gyp ERR! find Python GitHub - nodejs/node-gyp: Node.js native addon build tool · GitHub

17445 error gyp ERR! find Python **********************************************************

17445 error gyp ERR! find Python

17445 error gyp ERR! configure error

17445 error gyp ERR! stack Error: Could not find any Python installation to use

17445 error gyp ERR! stack at PythonFinder.fail (C:\Users\admin503034741\AppData\Roaming\npm\node_modules\n8n\node_modules\node-gyp\lib\find-python.js:330:47)

17445 error gyp ERR! stack at PythonFinder.runChecks (C:\Users\admin503034741\AppData\Roaming\npm\node_modules\n8n\node_modules\node-gyp\lib\find-python.js:159:21)

17445 error gyp ERR! stack at PythonFinder. (C:\Users\admin503034741\AppData\Roaming\npm\node_modules\n8n\node_modules\node-gyp\lib\find-python.js:228:18)

17445 error gyp ERR! stack at PythonFinder.execFileCallback (C:\Users\admin503034741\AppData\Roaming\npm\node_modules\n8n\node_modules\node-gyp\lib\find-python.js:294:16)

17445 error gyp ERR! stack at exithandler (node:child_process:424:5)

17445 error gyp ERR! stack at ChildProcess.errorhandler (node:child_process:436:5)

17445 error gyp ERR! stack at ChildProcess.emit (node:events:509:28)

17445 error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)

17445 error gyp ERR! stack at onErrorNT (node:internal/child_process:508:16)

17445 error gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:90:21)

17445 error gyp ERR! System Windows_NT 10.0.17763

17445 error gyp ERR! command “C:\\Program Files\\nodejs\\node.exe” “C:\\Users\\admin503034741\\AppData\\Roaming\\npm\\node_modules\\n8n\\node_modules\\node-gyp\\bin\\node-gyp.js” “rebuild”

17445 error gyp ERR! cwd C:\Users\admin503034741\AppData\Roaming\npm\node_modules\n8n\node_modules\sqlite3

17445 error gyp ERR! node -v v24.16.0

17445 error gyp ERR! node-gyp -v v8.4.1

17445 error gyp ERR! not ok

17446 silly unfinished npm timer reify 1782904097290

17447 silly unfinished npm timer reify:build 1782905243712

17448 silly unfinished npm timer build 1782905243715

17449 silly unfinished npm timer build:deps 1782905243716

17450 silly unfinished npm timer build:run:install 1782905244402

17451 silly unfinished npm timer build:run:install:node_modules/n8n/node_modules/sqlite3 1782905246616

GitHub - nodejs/node-gyp: Node.js native addon build tool

Node.js native addon build tool. Contribute to nodejs/node-gyp development by creating an account on GitHub.

執行此操作

停用 npm 的嚴格 SSL (在命令提示字元中執行):

npm config set strict-ssl false

清除 npm 快取​:

npm cache clean --force

嘗試重新安裝 n8n​:

npm install n8n -g

還有其他錯誤嗎?