n: Error: download preflight failed

Bug Report

Summary

When running n <version> I get this error message:

$ n 10

/usr/local/bin/n: line 194: [[: v10: syntax error: operand expected (error token is "v10")

  installing : node-vv10.23.0
curl: (3) [globbing] bad range in column 28

  Error: download preflight failed for 'v10.23.0' (https://nodejs.org/dist/vv10.23.0/node-vv10.23.0-darwin-x64.tar.xz)

it seems like the URL is incorrect: vv10.23.0 in the above example instead of v10.23.0

Steps to Reproduce

n 10 or n <version> or n v10

Expected Behaviour

Install node correctly

Actual Behaviour

Throws error

Other Information

n doctor runs fine n -V is 6.8.0 n 10.23.0 is the only command that runs/installs

Configuration Details

$ n --version
6.8.0

$ command -v node
/usr/local/bin/node

$ node -p process.platform
darwin

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (7 by maintainers)

Most upvoted comments

I found that without the v on the front of the version number I couldn’t install the specific version I was looking for.

sudo n i 16.10.0
Password:
  installing : node-v16.10.0
curl: (22) The requested URL returned error: 409 

  Error: download preflight failed for '16.10.0' (https://nodejs.org/dist/v16.10.0/node-v16.10.0-darwin-x64.tar.xz)

However, when I added the v to the front it worked:

sudo n i v16.10.0
Password:
  installing : node-v16.10.0
       mkdir : /usr/local/n/versions/node/16.10.0
       fetch : https://nodejs.org/dist/v16.10.0/node-v16.10.0-darwin-x64.tar.xz
   installed : v16.10.0 (with npm 7.24.0)

Huh. I’m out of time and ideas for now, will look again later! I am not sure the extra v alone explains the error messages you see during install.