N: sudo n stable Error:: invalid version

Created on 14 Mar 2018  Â·  32Comments  Â·  Source: tj/n

Issue Template:

Describe issue including what OS you are using

I'm using MacOS Sierra_10.12.6

Describe what version of N you have

n --version output: 2.1.7

Describe how you installed N

npm install -g n

Steps to reproduce issue

  1. sudo n stable

Describe the results you received

Error: invalid version

Describe the results you expected

I was supposed to see the stable version being pulled from source

What version of npm you are using

npm --version output: 3.10.10

Additional information you deem important (e.g. issue happens only occasionally):

  • Output of which n: /usr/local/bin/n
  • Output of node -v: v6.11.2
  • Output of which curl: /usr/bin/curl
  • Output of curl --version:
    curl 7.54.0 (x86_64-apple-darwin16.0) libcurl/7.54.0 SecureTransport zlib/1.2.8 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets

Most helpful comment

@a3v0 I think your problem is the second machine is a 32-bit architecture (i686). n uses the pre-built binaries from nodejs, and 32-bit builds for Linux were dropped for node 10.

https://github.com/nodejs/build/issues/885

However, node 8 is still being supported, and has 32-bit builds, so you can hopefully use that. e.g.

n 8

or explicit version:

n 8.15.0

All 32 comments

I was not able to reproduce your issue (also on Mac), but suggest you try lts instead of stable.

$ n --stable
9.8.0
$ n --lts
8.10.0

sure, but -- just lists the current version of each whereas OP is trying to install (stable). I get the same problem; n stable, n latest, n lts, n 8.11.1 all come back with "invalid version"

Can I see a pic ?

On Apr 25, 2018, at 10:20 AM, waffledonkey notifications@github.com wrote:

sure, but -- just lists the current version of each whereas OP is trying to install (stable). I get the same problem; n stable, n latest, n lts, n 8.11.1 all come back with "invalid version"

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

certainly

image

Yes same problem, stable or lts or latest all give invalid version.

@waffledonkey thanks. I had assumed n --lts would be broken too.

Someone with the problem, does sudo n --lts work, or is broken when run with sudo?

@JohnRGee sudo n --lts, stable, etc produces no output whatsoever

Possibly related info, there were changes in curl in the 29 March release of macOS Sierra 10.12.6:
https://support.apple.com/en-us/HT208692

[edit] I don't think curl changes were the issue

I'm having this issue as well on macOS Sierra 10.12.6

I didn't get that far into it, but the methods like install_lts() (shown below) calls install $(display_latest_lts_version) which doesn't actually "return" or "echo". It's been about 20 years since I did any serious Bash programming, but I thought you had to do one or the other. :(

install_lts() {
  check_io_supported "lts"
  install $(display_latest_lts_version)
}
display_latest_lts_version() {
  check_io_supported "--lts"
  local folder_name=$($GET 2> /dev/null ${MIRROR[$DEFAULT]} \
    | egrep "</a>" \
    | egrep -o 'latest-[a-z]{2,}' \
    | sort \
    | tail -n1)

  $GET 2> /dev/null ${MIRROR[$DEFAULT]}/$folder_name/ \
    | egrep "</a>" \
    | egrep -o '[0-9]+\.[0-9]+\.[0-9]+' \
    | head -n1
}



md5-23b13ad8374e1fbbfaf8dc0105719902



curl -L -# 2> /dev/null https://nodejs.org/dist/latest-carbon
     | egrep "</a>"
     | egrep -o '[0-9]+\.[0-9]+\.[0-9]+'
     | head -n1

if you dump that straight into a terminal it comes back as expected; 8.11.1 but called as it is presently "version" is empty, as shown by set -vx. If I tack on a hard-coded echo "8.11.1" to the bottom of the display_latest_lts_version then it does get further... it outputs: install : node-v8.11.1

before throwing _an_ invalid version -- because the next method calls a method in a similar way without a return/echo.

What's baffling to me is thatcURL and n are both the same version on two different machines available to me, one works one does not. I was also surprised to see it written in Bash. Maybe it has to be, but we know Node is available and most of it seems like it'd be easier to do in a higher-level language -- maybe?

I get this exact same error on CentOS

I had same issue running sudo n stable to update node. To fix this I used Node Version Manager (NVM). Just run the command: nvm install 10.0.3 . or any desired version number you want to install

I can’t get that installed.

Seems like a lot of my problems are proxy related too.

I had get the same wrong in Win10

Invalid version is a catch-all for could not find version, so multiple possible causes including proxy issues. To find out if you have proxy or authentication type issues somewhat outside n, trying a direct connection to the default node mirror (or the mirror you are using) can be informative. e.g.

curl https://nodejs.org/dist/

Installing curl locally somehow fixed the issue for me... :laughing:

@vyzaldysanchez what curl version are you using?

Same error for me on Ubuntu 16.04 LTS.

radmin@RoR-dev-01:~$ n --lts
10.14.2
radmin@RoR-dev-01:~$ n lts

     install : node-v10.14.2

  Error: invalid version 10.14.2

radmin@RoR-dev-01:~$ sudo n lts

     install : node-v10.14.2

  Error: invalid version 10.14.2

We can hopefully find the underlying issue @brandoncordell but will take some investigation. Interesting that you can look up the lts version, but not download it.

1) Are you using a mirror site? (i.e. do you have NODE_MIRROR defined?)

2) Is your internet connection through a proxy server?

3) What version of n are you using? (n --version)

4) Do you have curl installed? (curl --version)

5) What does uname -a return?

@byrenx cannot recall at the moment, I've changed my linux laptop so I'm not using that env anymore, sorry I couldn't be of more help here...

Seeing this problem on one machine but not the other

Will post the requested versions in a follow up. Just in case posting here fails.

on both machines as root I did
npm cache clean -f
npm install -g n
n stable

no proxy. The working machine is on wifi and the nonworking is plugged into my router. Don't think that should matter but it is a difference.

working machine

Mirror?
Just started using npm and am using whatever defaults sites for sources they provide.

uname -a
Linux mosqito 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26) x86_64 GNU/Linux

curl does not seem to be installed

root@mosqito:/home/howard# npm cache clean -f
npm WARN using --force I sure hope you know what you are doing.
root@mosqito:/home/howard# npm install -g n
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
[email protected] /usr/local/lib/node_modules/n
root@mosqito:/home/howard# n stable
root@mosqito:/home/howard#

Node Red Startup
30 Dec 12:40:28 - [info] Starting flows
30 Dec 12:40:28 - [info] Started flows
30 Dec 12:40:28 - [info] Server now running at http://127.0.0.1:1880/
30 Dec 12:40:23 - [info] Node-RED version: v0.19.5
30 Dec 12:40:23 - [info] Node.js version: v11.6.0
30 Dec 12:40:23 - [info] Linux 3.16.0-4-amd64 x64 LE
30 Dec 12:40:24 - [info] Loading palette nodes
30 Dec 12:40:27 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
30 Dec 12:40:27 - [warn] rpi-gpio : Cannot find Pi RPi.GPIO python library
30 Dec 12:40:28 - [info] Settings file : /root/.node-red/settings.js
30 Dec 12:40:28 - [info] Context store : 'default' [module=memory]
30 Dec 12:40:28 - [info] User directory : /root/.node-red
30 Dec 12:40:28 - [warn] Projects disabled : editorTheme.projects.enabled=false
30 Dec 12:40:28 - [info] Flows file : /root/.node-red/flows_mosqito.json
30 Dec 12:40:28 - [info] Creating new flow file

Non working

uname -a
Linux silver 4.9.0-0.bpo.7-686 #1 SMP Debian 4.9.110-3+deb9u2~deb8u1 (2018-08-14) i686 GNU/Linux

Mirror?
Just started using npm and am using whatever defaults sites for sources they provide.

root@silver:/home/howard# npm cache clean -f
npm WARN using --force I sure hope you know what you are doing.
root@silver:/home/howard# npm install -g n
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
[email protected] /usr/local/lib/node_modules/n
root@silver:/home/howard# n stable
install : node-v11.6.0
Error: invalid version 11.6.0

@a3v0 I think your problem is the second machine is a 32-bit architecture (i686). n uses the pre-built binaries from nodejs, and 32-bit builds for Linux were dropped for node 10.

https://github.com/nodejs/build/issues/885

However, node 8 is still being supported, and has 32-bit builds, so you can hopefully use that. e.g.

n 8

or explicit version:

n 8.15.0

Thanks for the rapid reply. I will give it a shot. What I should do is replace that machine.

I installed n using brew install n
Using sudo n stable upgraded to latest version
n --version : 2.1.12
node -v : v11.8.0
npm --version: 6.5.0

@yathamravali stable is an old term and was broken by changes to node releases (#335). You will hopefully get expected behaviour by using lts instead.

sudo n lts

(Pull Request #467 makes stable an alias for lts to fix this problem, but has not been released yet.)

I recommend opening a new issue for further problems, as this issue now covers multiple different problems and hard to tell which ones have been solved.

@a3v0 I think your problem is the second machine is a 32-bit architecture (i686). n uses the pre-built binaries from nodejs, and 32-bit builds for Linux were dropped for node 10.

nodejs/build#885

However, node 8 is still being supported, and has 32-bit builds, so you can hopefully use that. e.g.

n 8

or explicit version:

n 8.15.0

Hi @JohnRGee, here I have the same problem, I can't fetch node: >8. I found that the OS runs in 32bit. What could we do other than switching to 64bit to have the latest node?

@Francesco-Rizzi
If your OS is still being supported there might be newer versions of node available through your platform package manager, or a hands-on option is building from source.

https://github.com/nodejs/node/blob/master/BUILDING.md

For proxy issues causing "invalid version", see #482

If you are still stuck seeing the "invalid version" message, please open a new issue for your situation. This thread is pretty messy and I don't want to add further to it!

The long term plans to improve this are improve the error messages for failure conditions, or write a FAQ...

Prerelease available via npm i n@next for v6. Release notes: https://github.com/tj/n/releases/tag/6.0.0-0

Much improved error messages in v6: https://github.com/tj/n/releases/tag/v6.0.0

Was this page helpful?
0 / 5 - 0 ratings