volta icon indicating copy to clipboard operation
volta copied to clipboard

Node is not available when running npx command

Open hadasgazit opened this issue 3 years ago • 7 comments

I'm trying to install storybook, using npx in a project using volta. I'm getting the error "Node is not available"

when running VOLTA_LOGLEVEL=debug I'm getting: [verbose] Found default configuration at '/home/hadasg/.volta/tools/user/platform.json' [verbose] [email protected] has already been fetched, skipping download [verbose] [email protected] has already been fetched, skipping download [verbose] Active Image: Node: 16.13.1 from project configuration npm: 8.1.2 from project configuration pnpm: None Yarn: 1.22.17 from project configuration [verbose] Could not find Volta-managed platform, delegating to system Volta error: Node is not available.

To run any Node command, first set a default version using volta install node [verbose] Error cause: No such file or directory (os error 2) Error details written to /home/hadasg/.volta/log/volta-error-2023-01-29_19_19_51.390.log [verbose] No custom hooks found [verbose] No custom hooks found

volta version is 1.1.1 (although it also happened with version 1.0.5)

hadasgazit avatar Jan 29 '23 17:01 hadasgazit

Can you provide simple reproducible example?

mufasa71 avatar Jan 30 '23 08:01 mufasa71

for me it was just running in cmd: npx storybook init

(I'm using ubuntu)

hadasgazit avatar Jan 30 '23 09:01 hadasgazit

Can you try running volta install node ?

mufasa71 avatar Jan 30 '23 19:01 mufasa71

Hi @hadasgazit, that's very strange! It's not obvious from the debug log what exactly is going on. What appears to be happening is that Volta is finding the expected Node version, launching that, and then something in that script is trying to launch node itself and failing to find it. What's extra strange is that when Volta launches the node script, it sets the PATH to include Node, so it shouldn't be falling through back to Volta again.

Another possibility is that Volta failed to properly fetch Node the first time and left itself in a broken state where it thinks it's downloaded, but it doesn't actually have the appropriate file. Can you confirm what the contents of ~/.volta/tools/image/node/16.13.1/bin are?

charlespierce avatar Jan 30 '23 22:01 charlespierce

I got the same error. and BTW volta is running properly when running yarn install in the project. it is just those npx commands that results this error

hadasgazit avatar Jan 31 '23 06:01 hadasgazit

contant of ~/.volta/tools/image/node/16.13.1/bin is: drwxr-xr-x 2 hadasg hadasg 4096 Jan 30 08:47 . drwxr-xr-x 6 hadasg hadasg 4096 Jan 30 08:47 .. lrwxrwxrwx 1 hadasg hadasg 45 Jan 30 08:47 corepack -> ../lib/node_modules/corepack/dist/corepack.js -rwxr-xr-x 1 hadasg hadasg 79310832 Dec 1 2021 node lrwxrwxrwx 1 hadasg hadasg 38 Jan 30 08:47 npm -> ../lib/node_modules/npm/bin/npm-cli.js lrwxrwxrwx 1 hadasg hadasg 38 Jan 30 08:47 npx -> ../lib/node_modules/npm/bin/npx-cli.js

hadasgazit avatar Jan 31 '23 10:01 hadasgazit

I encountered a similar error with an npx command. I was able to resolve the error by:

  1. deleting the target node version at ~/.volta/tools/image/node/
  2. Re-running command (reinstalled the target node version set by Volta)

JonathanReiss15 avatar Jan 03 '24 00:01 JonathanReiss15