WSL icon indicating copy to clipboard operation
WSL copied to clipboard

wsl exits with code when running npm test

Open ChandanSouL opened this issue 9 months ago • 6 comments

Windows Version

Microsoft windows 11 pro 24H2

WSL Version

WSL version: 2.6.3.0

Are you using WSL 1 or WSL 2?

  • [x] WSL 2
  • [ ] WSL 1

Kernel Version

Kernel version: 6.6.87.2-1

Distro Version

Ubuntu 24.04

Other Software

WSL version 2.6.3.0 When running npm test on my WSL ubuntu 24.04 I face this exited code [process exited with code 1 (0x00000001)] You can now close this terminal with Ctrl+D, or press Enter to restart. after some time. node version is 12.22.12 While running the same npm test on my windows it runs fine, because I want to have flexibilty with my node versions (I usually change my node versions depending on projects) is this an issue with WSL or on the node

Repro Steps

install node verison 12.22. run npm test it fails after some time

Expected Behavior

npm test should be successfully completed operation

Actual Behavior

system errored out/exited with code 1

Diagnostic Logs

No response

ChandanSouL avatar Feb 23 '26 07:02 ChandanSouL

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues

Once completed please upload the output files to this GitHub issue.

See Collect WSL logs (recommended method).

If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

github-actions[bot] avatar Feb 23 '26 07:02 github-actions[bot]

/question

ChandanSouL avatar Feb 24 '26 05:02 ChandanSouL

Diagnostic information
Found '/question', adding tag 'question'

github-actions[bot] avatar Feb 24 '26 05:02 github-actions[bot]

/logs

OneBlue avatar Feb 24 '26 22:02 OneBlue

Hey @ChandanSouL,

your Node version 12.22.12 is super outdated, that went End-of-Life back in April 2022. Running it on Ubuntu 24.04 is gonna cause all kinds of weird issues like the one you're seeing here.

Pretty sure this isn't a WSL problem at all. Try upgrading to Node 22 LTS (that's the current long-term support version, maintained until 2027):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash source ~/.bashrc nvm install 22 nvm use 22

After that just run npm test again. The exit code 1 simply means your test failed, WSL itself isn't crashing or anything. Let us know if the upgrade fixes it!

shimscho avatar Feb 25 '26 08:02 shimscho

I don't have admin permissions, to generate the logs as it requires elevation. Upgrading my node version may cause several discrepancies to my project as this was old project.. will try to build with new node version. @shimscho Thanks will try with node 22

ChandanSouL avatar Feb 25 '26 10:02 ChandanSouL