volta icon indicating copy to clipboard operation
volta copied to clipboard

Does not work on WSL2 Ubuntu 24.04

Open oleksii-lukin opened this issue 10 months ago • 0 comments

I have Ubuntu 24.04 with zsh installed in WSL2 and was following a guide on node site: https://nodejs.org/en/download

# On most Unix systems including macOS, you can install with a single command:
curl https://get.volta.sh | bash
# Download and install Node.js:
volta install node@23
# Verify the Node.js version:
node -v # Should print "v23.8.0".
# Download and install pnpm:
corepack enable pnpm
# Verify pnpm version:
pnpm -v

When I tried to execute corepack enable pnpm I got an error zsh: /mnt/c/Program Files/nodejs/corepack: bad interpreter: /bin/sh^M: no such file or directory

According to this, it related to PATH not being defined properly https://stackoverflow.com/questions/39311147/cannot-run-npm-commands, I tried to follow some advices, updating my .zshrc manually, but without success, so I tried to use nvm, and it worked with it

# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# in lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"
# Download and install Node.js:
nvm install 23
# Verify the Node.js version:
node -v # Should print "v23.8.0".
nvm current # Should print "v23.8.0".
# Download and install pnpm:
corepack enable pnpm
# Verify pnpm version:
pnpm -v

oleksii-lukin avatar Feb 23 '25 13:02 oleksii-lukin