Describe the problem/error/question
When I install a node in the community, the bottom right corner shows Error loading package “n8n-nodes-feishu-lite”: Failed to execute npm command Cause: spawn npm ENOENT
I tried another blogger’s method, checked the node path and npm version, and all these installations were fine. Then I also deleted the leftover node files and chose to reinstall, but the same error still occurred.
What is the error message (if any)?
Error loading package “n8n-nodes-feishu-lite” :Failed to execute npm command Cause: spawn npm ENOENT
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
n8n version:
Database (default: SQLite):
n8n EXECUTIONS_PROCESS setting (default: own, main):
Running n8n via (Docker, npm, n8n cloud, desktop app):
Operating system:
Hi @Rorschach , this is a known Windows bug, on Windows, npm runs as npm.cmd but n8n looks for plain npm, so it can’t find it and throws ENOENT.
Two fixes:
Option 1: Install the community node manually via command line instead of the UI:
cd ~/.n8n
npm install n8n-nodes-feishu-lite
Then restart n8n.
Option 2 Source code fix (if you need UI installs to work): Edit this file: C:\Users\YourUsername\AppData\Roaming\npm\node_modules\n8n\dist\modules\community-packages\community-packages.service.js
Find the asyncExecFile('npm', ...) call and add shell: true to its options. This is the fix documented in GitHub issue #22706 .
1 Like
Hi @Rorschach
See a full indepth solution here:
Hi @Fire_Uchiha
This is an environment issue : n8n cannot find the npm executable on your system.
On Windows, this usually means Node.js / npm is not available in the PATH for the process running n8n .
When you install a community node , n8n internally runs:
Also:
opened 06:05AM - 04 Dec 25 UTC
Needs Feedback
triage:needs-info
status:in-linear
### Bug Description
When installing community nodes in n8n under the Windows en… vironment, the "spawn npm ENOENT" error often occurs. The core reason is that n8n does not adapt to Windows script suffix resolution when calling npm.
### To Reproduce
Setting->Community nodes->Install
### Expected behavior
Update n8n version to 1.122.4, install community node get "spawn npm ENOENT". It worked fine in the previous version.
### Debug Info
This problem can be solved once and for all by modifying the n8n source code to add the `shell: true` parameter to the `execFile` call. Here are the detailed steps.
## Core Solution: Source Code Modification to Adapt to Windows npm Calls
n8n calls npm through `asyncExecFile` (a Promise wrapper for `execFile`). On Windows, the `npm.cmd` suffix needs to be parsed through the Shell. Adding the `shell: true` parameter to all npm calls enables compatibility.
### Step 1: Locate the Core Configuration File
The n8n community package management logic is located in the compiled JS file (no need to modify TS source code), with a fixed path:
```Plain Text
C:\Users\YourUsername\AppData\Roaming\npm\node_modules\n8n\dist\modules\community-packages\community-packages.service.js
```
Open this file with VS Code or Notepad++, and search for "asyncExecFile('npm'" to locate 3 npm call points.
### Step 2: Modify the Three execFile Calls
Add the `shell: true` option to each `asyncExecFile('npm'` call. The specific modifications are as follows:
#### 1. Modify the executeNpmCommand Method
Find the `execOptions` configuration block and add `shell: true`:
```Plain Text
// Original code
const execOptions = {
cwd: this.downloadFolder,
env: { NODE_PATH: process.env.NODE_PATH, PATH: process.env.PATH, APPDATA: process.env.APPDATA, NODE_ENV: 'production' },
};
// Modified code
const execOptions = {
cwd: this.downloadFolder,
env: { NODE_PATH: process.env.NODE_PATH, PATH: process.env.PATH, APPDATA: process.env.APPDATA, NODE_ENV: 'production' },
shell: true, // Add this line
};
```
#### 2. Modify the npm pack Call in downloadPackage
Add `shell: true` to the configuration of the `npm pack` call:
```Plain Text
// Original code
const { stdout: tarOutput } = await asyncExecFile('npm', ['pack', `${packageName}@${packageVersion}`, `--registry=${registry}`, '--quiet'], { cwd: this.downloadFolder });
// Modified code
const { stdout: tarOutput } = await asyncExecFile('npm', ['pack', `${packageName}@${packageVersion}`, `--registry=${registry}`, '--quiet'], {
cwd: this.downloadFolder,
shell: true // Add this line
});
```
#### 3. Modify the npm install Call in downloadPackage
Add `shell: true` to the configuration of the `npm install` call:
```Plain Text
// Original code
await asyncExecFile('npm', ['install', ...this.getNpmInstallArgs()], { cwd: packageDirectory });
// Modified code
await asyncExecFile('npm', ['install', ...this.getNpmInstallArgs()], {
cwd: packageDirectory,
shell: true // Add this line
});
```
### Step 3: Restart n8n to Verify the Effect
1. Save the modified file;
2. End all `node.exe` processes in Task Manager (completely shut down n8n background processes);
3. Re-execute `n8n start` to launch the service;
4. Install a community node directly in n8n (e.g., @fictionking/n8n-nodes-stream-respond). If it can be installed normally, the modification is effective.
> (Note: Some parts of the document may be generated by AI)
### Operating System
Windows 11
### n8n Version
Version 1.122.4
### Node.js Version
v22.11.0
### Database
SQLite (default)
### Execution mode
main (default)
### Hosting
self hosted
Let us know how this goes for you - here on stand by
I have already tried this solution, but it doesn’t work. The error message still persists
I will try the second plan you gave me and inform you of the outcome. Thank you
1 Like
Thank you. I will give this plan a try
I tried manual installation and it has been successful so far. Thank you for your advice!
1 Like