Hi Team,
Describe the problem/error/question
When I try to install n8n version 1.68.0 using the command pnpm install it’s failing on one prepared script.
What is the error message (if any)?
. prepare$ node scripts/prepare.mjs
│ ‘.’ is not recognized as an internal or external command,
│ operable program or batch file.
│ node:internal/errors:956
│ const err = new Error(message);
│ ^
│ Error: Command failed: ./node_modules/.bin/lefthook install
Information on your n8n setup
n8n version: 1.68.0
Database (default: SQLite): postgresql
n8n EXECUTIONS_PROCESS setting (default: own, main): own
Running n8n via (Docker, npm, n8n cloud, desktop app): pnpm
Operating system: windows
Jon
November 28, 2024, 4:12am
2
Hey @Tanay_Acro
Are you using the latest master branch of n8n?
Hi @Jon ,
Yes I’m Using latest master branch.
Hi @Jon
Can you tell me how to resolved this issue.
netroy
December 3, 2024, 8:22am
5
can you try deleting this line .
Hi @netroy ,
It’s crashing after run locally. This is error
n8n-editor-ui:dev:
n8n-editor-ui:dev: VITE v5.4.8 ready in 13909 ms
n8n-editor-ui:dev:
n8n-editor-ui:dev: ➜ Local: http://localhost:8080/
n8n-editor-ui:dev: ➜ Network: http://172.31.48.1:8080/
n8n-editor-ui:dev: ➜ Network: http://192.168.10.12:8080/
n8n-workflow:dev:
n8n-workflow:dev: 3:01:02 pm - Found 0 errors. Watching for file changes.
@n8n /json-schema-to-zod:dev:
@n8n /json-schema-to-zod:dev: 3:01:12 pm - Found 0 errors. Watching for file changes.
@n8n /api-types:dev:
@n8n /api-types:dev: 3:01:21 pm - Found 0 errors. Watching for file changes.
n8n-core:dev:
n8n-core:dev: 3:01:25 pm - Found 0 errors. Watching for file changes.
3:03:28 pm - Starting compilation in watch mode…
n8n:dev: [TypeScript]
n8n:dev: [Node]
n8n:dev: [Node] > [email protected] start:windows
n8n:dev: [Node] > cd bin && n8n
n8n:dev: [Node]
n8n:dev: [Node] » Error: command start not found
n8n:dev: [Node] [nodemon] app crashed - waiting for file changes before starting…
netroy
December 3, 2024, 1:34pm
7
These seem like issues with a Windows dev environment?
Are you using WSL? if not, can you please try that?
Here is the solution:
n8n-io:master
← mpoc:master
opened 02:06PM - 07 Nov 24 UTC
## Summary
The repository preparation script fails on Windows (cmd and PowerS… hell) due to cmd incompatible path when using `execSync` in the `prepare.mjs` script.
When running `pnpm install`, the preparation script fails with the following error:
```
. prepare$ node scripts/prepare.mjs
│ '.' is not recognized as an internal or external command,
│ operable program or batch file.
│ node:internal/errors:983
│ const err = new Error(message);
│ ^
│ Error: Command failed: ./node_modules/.bin/lefthook install
│ at genericNodeError (node:internal/errors:983:15)
│ at wrappedFn (node:internal/errors:537:14)
│ at checkExecSyncError (node:child_process:888:11)
│ at execSync (node:child_process:960:15)
│ at file:///C:/Users/mpoc/src/n8n/scripts/prepare.mjs:10:1
│ at ModuleJob.run (node:internal/modules/esm/module_job:268:25)
│ at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)
│ at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5) {
│ status: 1,
│ signal: null,
│ output: [ null, null, null ],
│ pid: 17852,
│ stdout: null,
│ stderr: null
│ }
│ Node.js v22.11.0
└─ Failed in 114ms at C:\Users\mpoc\src\n8n
ELIFECYCLE Command failed with exit code 1.
```
It happens because `lefthook` is executed directly from the `node_modules` path in this line in `scripts/prepare.mjs`:
```javascript
execSync('./node_modules/.bin/lefthook install', { stdio: 'inherit' });
```
This works fine when using PowerShell directly, but cmd does not resolve `.` as current directory, and cmd is the [default shell on Windows when using `execSync`](https://nodejs.org/api/child_process.html#default-windows-shell).
This change replaces direct execution of `lefthook` with `npx`, which handles cross-platform path resolution automatically:
```javascript
execSync('npx lefthook install', { stdio: 'inherit' });
```
## Related Linear tickets, Github issues, and Community forum posts
N/A
## Review / Merge checklist
- [x] PR title and summary are descriptive. ([conventions](../blob/master/.github/pull_request_title_conventions.md)) <!--
**Remember, the title automatically goes into the changelog.
Use `(no-changelog)` otherwise.**
-->
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up ticket created.
- [ ] Tests included. <!--
A bug is not considered fixed, unless a test is added to prevent it from happening again.
A feature is not complete without tests.
-->
- [ ] PR Labeled with `release/backport` (if the PR is an urgent fix that needs to be backported)
It hasn’t been merged into master yet. So you need to open /scripts/prepare.mjs
and change line 10 from
execSync('./node_modules/.bin/lefthook install', { stdio: 'inherit' });
to
execSync(`npx lefthook install`, { stdio: 'inherit' });
or use path.normalize()
as
#!/usr/bin/env node
import { execSync } from 'node:child_process';
import { normalize } from "path";
// Skip lefthook install in CI or Docker build
if (process.env.CI || process.env.DOCKER_BUILD) {
process.exit(0);
}
const normalizedPathToCommand = normalize('./node_modules/.bin/lefthook');
execSync(`${normalizedPathToCommand} install`, { stdio: 'inherit' });
Hi @dobromyslov ,
I tried Above Solutions. But it’s not working.
thank you,
Tanay
system
Closed
March 9, 2025, 12:07pm
10
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.