nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.48k stars 284 forks source link

Windows 11 ENOENT -4058 #4095

Closed jcs090218 closed 1 year ago

jcs090218 commented 1 year ago

Version

16.x and 18.x

Platform

Windows 11

Subsystem

No response

What steps will reproduce the bug?

# clone the project
$ git clone https://github.com/emacs-eask/cli

# navigate to project root
$ cd cli

# install all modules
$ npm install

# start program `eask.bat` and execute the command
$ cli/bin/eask.bat info

How often does it reproduce? Is there a required condition?

consistent.

What is the expected behavior?

Run without the error, -4058.

What do you see instead?

Running Eask in the development environment
Press Ctrl+C to cancel.

Executing script inside Emacs...
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn emacs ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:485: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:291:12)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn emacs',
  path: 'emacs',
  spawnargs: [
    '-Q',
    '--script',
    'D:\\_workspace\\_eask\\cli\\lisp\\core\\info.el'
  ]
}

Additional information

Related SO: https://stackoverflow.com/questions/73041590/windows-11-npm-err-errno-4058-code-enoent-bash

mscdex commented 1 year ago

You should submit this issue to the project in question instead (https://github.com/emacs-eask/cli).

jcs090218 commented 1 year ago

I'm the creator of this tool https://github.com/emacs-eask/cli. The issue is regarding node and Windows 11. Not the tool itself, the tool works great in Windows 10 but not 11.

prettydiff commented 1 year ago

A translation of the error message means that you are attempting to run Emacs in a spawned child process but Emacs is not there. I don't think this is a Node issue at all. Emacs is not on Windows unless you put it on windows or execute an environment on Windows containing Emacs. For example, the SO link you provided indicated the problem went away when that person executed their script in git-bash. git-bash likely does provide Emacs even when running on Windows.

The solution then is to either provide Emacs as a dependency of your project that your project installs on Windows or tell your users to manually install it themselves.

jcs090218 commented 1 year ago

Oh.... okay. It was a stupid mistake. Apparently the installer does not set up the PATH for me on Windows 11 for some reason.

Sorry for the noise. 😓