astro-netlify-cms
astro-netlify-cms copied to clipboard
Error: spawn netlify-cms-proxy-server ENOENT on "astro dev
Working on a Windows OS and running astro dev returns the following error.
node:events:368
throw er; // Unhandled 'error' event
^
Error: spawn netlify-cms-proxy-server ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn netlify-cms-proxy-server',
path: 'netlify-cms-proxy-server',
spawnargs: []
}
when I manually start the proxy server and comment out:
/* 'astro:server:start': () => {
const proxy = spawn('netlify-cms-proxy-server', { stdio: 'inherit' });
process.on('exit', () => proxy.kill());
}, */
it works.
Oh interesting! I guess this is an issue with running an npm package from the command line on Windows maybe? I don’t have a Windows machine to test on unfortunately.
I’d be interested to see if npx netlify-cms-proxy-server
in the spawn
call might work if it’s an issue with finding the command?
Think that windows need a "shell = true". this seems to work for me:
'astro:server:start': () => {
const proxy = spawn('npx netlify-cms-proxy-server', { stdio: 'inherit', shell: process.platform == 'win32' });
process.on('exit', () => proxy.kill());
},
Thanks for investigating! Would you like to make this change in a PR?
I can't test if this solution works on Linux or OSX, so it could potentially introduce more bugs than it fixes :P
I can test it on macOS and can take a look at setting up some CI tests for Linux!
Seeing the same issue on Windows. @delucis & @preetamslot is there an ETA on the pull request merge? Thanks!
I think #15 was going to address two separate things, so I’ve pushed @preetamslot’s simple fix for Windows as a separate commit for now. Released in v0.2.0 — let me know how you get on!
I have the same issue with Yarn (classic or stable) on macOS. pnpm works
git clone delucis/astro-netlify-cms-starter yarn ...
% yarn dev
🚀 astro v1.5.2 started in 85ms
┃ Local http://localhost:3001/
┃ Network use --host to expose
node:events:491
throw er; // Unhandled 'error' event
^
Error: spawn netlify-cms-proxy-server ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:285:19)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn netlify-cms-proxy-server',
path: 'netlify-cms-proxy-server',
spawnargs: []
}
Node.js v19.2.0
% yarn -v
3.3.0
I'm experiencing the same issue using pnpm
> astro dev
🚀 astro v1.7.2 started in 333ms
┃ Local http://localhost:3000/
┃ Network use --host to expose
node:events:491
throw er; // Unhandled 'error' event
^
Error: spawn netlify-cms-proxy-server ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn netlify-cms-proxy-server',
path: 'netlify-cms-proxy-server',
spawnargs: []
}
Node.js v18.12.1
ELIFECYCLE Command failed with exit code 1.