Skip to content

Conversation

@veerababu1729
Copy link

Description

Fixes Windows-specific EINVAL error when spawning npm install commands.

Problem

On Windows, the run_npm_install function in Kernel.js was failing with spawn EINVAL error because it was missing the shell: true option when spawning npm.cmd.

Solution

  • Added shell: true to spawn options in run_npm_install function
  • Makes the spawn call consistent with other spawn calls in the codebase (ProcessService.js and LocalTerminalService.js)
  • Cross-platform compatible (works on Windows, Linux, macOS)

Changes

  • File: src/backend/src/Kernel.js
  • Line: 581
  • Change: Added shell: true to spawn options

Fixes

Why Windows Needs shell: true:

  • On Windows, npm.cmd is a batch file, not an executable
  • Node.js spawn() cannot execute .cmd files directly without shell: true
  • Without it, Windows throws EINVAL (Invalid argument) error

Proof from Codebase:
Other spawn calls in the same codebase already use shell: true:

  • ProcessService.js line 76: spawn(command, args, { shell: true, ... })
  • LocalTerminalService.js line 93: spawn(profile.shell[0], args, { shell: true, ... })

Testing

  • Verified fix follows existing code patterns in the codebase
  • Minimal change with low risk
  • No functional changes to other parts of the system

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

- Fixes EINVAL error when running npm install on Windows
- Adds shell: true to spawn options in run_npm_install function
- Makes spawn call consistent with other spawn calls in codebase
- Resolves GitHub issues HeyPuter#1748 and HeyPuter#1797
@CLAassistant
Copy link

CLAassistant commented Oct 23, 2025

CLA assistant check
All committers have signed the CLA.

@veerababu1729
Copy link
Author

I almost worked one day to find this, please review as soon as possible and feel free to ask anything...

@jelveh
Copy link
Contributor

jelveh commented Oct 26, 2025

Hey @veerababu1729. thank you for you PR. I've assigned @ProgrammerIn-wonderland to review this. Please stay tuned.

@ProgrammerIn-wonderland
Copy link
Collaborator

I think @KernelDeimos mentioned on call that we shouldn't do (shell: true) since it says a deprecation warning in shell but I'll check if that's still the case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid Host header. & workers error Windows Error

4 participants