Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EINVAL crash on latest nodejs #77

Open
TwitchBronBron opened this issue Oct 10, 2024 · 3 comments
Open

EINVAL crash on latest nodejs #77

TwitchBronBron opened this issue Oct 10, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@TwitchBronBron
Copy link
Member

There's a weird crash with the latest version of NodeJS when running ropm.

$ ropm install roku-requests
Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at Object.spawn (node:child_process:760:9)
    at C:\Users\bronley\AppData\Roaming\npm\node_modules\ropm\dist\util.js:24:40
    at new Promise (<anonymous>)
    at Util.spawnAsync (C:\Users\bronley\AppData\Roaming\npm\node_modules\ropm\dist\util.js:23:16)
    at Util.spawnNpmAsync (C:\Users\bronley\AppData\Roaming\npm\node_modules\ropm\dist\util.js:37:21)
    at InstallCommand.npmInstall (C:\Users\bronley\AppData\Roaming\npm\node_modules\ropm\dist\commands\InstallCommand.js:70:27)
    at async InstallCommand.run (C:\Users\bronley\AppData\Roaming\npm\node_modules\ropm\dist\commands\InstallCommand.js:39:13) {
  errno: -4071,
  code: 'EINVAL',
  syscall: 'spawn'
} 
@TwitchBronBron TwitchBronBron added the bug Something isn't working label Oct 10, 2024
@OLSA
Copy link

OLSA commented Dec 13, 2024

I get this error while trying to install ropm modules (my node version 20.18.1).
The error occurs because recent versions of Node.js block spawning .cmd files directly for security reasons (in this case npm.cmd). This can be resolved by adding { shell: true } to the options passed to child_process.spawn (link).

In my case, I directly edited the file node_modules\ropm\dist\util.js at line 24.
Originally was:

const child = childProcess.spawn( command, args !== null && args !== void 0 ? args : [], Object.assign( Object.assign({}, (options !== null && options !== void 0 ? options : {})), { stdio: 'inherit' } ) );

modified it to:

const child = childProcess.spawn( command, args !== null && args !== void 0 ? args : [], Object.assign( Object.assign({}, (options !== null && options !== void 0 ? options : {})), { stdio: 'inherit', shell: true } ) );

This change seems to resolve the issue, as the module installation now works correctly.
Regards.

@addison-adler
Copy link
Contributor

addison-adler commented Dec 22, 2024

I am also seeing this error. Has this fix been added to a published version of ropm?

I tried to use the line change mentioned above but it still didn't work for me 🙁

@addison-adler
Copy link
Contributor

@OLSA Thank you for your insights! We applied the patch and it's released now in version 0.10.29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants