astro-netlify-cms icon indicating copy to clipboard operation
astro-netlify-cms copied to clipboard

Error: spawn netlify-cms-proxy-server ENOENT on "astro dev

Open preetamslot opened this issue 1 year ago • 5 comments

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.

preetamslot avatar Jul 20 '22 11:07 preetamslot

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?

delucis avatar Jul 20 '22 12:07 delucis

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());
            },

preetamslot avatar Jul 22 '22 06:07 preetamslot

Thanks for investigating! Would you like to make this change in a PR?

delucis avatar Jul 22 '22 08:07 delucis

I can't test if this solution works on Linux or OSX, so it could potentially introduce more bugs than it fixes :P

preetamslot avatar Jul 24 '22 18:07 preetamslot

I can test it on macOS and can take a look at setting up some CI tests for Linux!

delucis avatar Jul 24 '22 19:07 delucis

Seeing the same issue on Windows. @delucis & @preetamslot is there an ETA on the pull request merge? Thanks!

ghost avatar Sep 01 '22 14:09 ghost

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!

delucis avatar Sep 02 '22 11:09 delucis

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

zanami avatar Dec 21 '22 03:12 zanami

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.

techguysimon avatar Dec 26 '22 23:12 techguysimon