Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sudo n stable Error:: invalid version #492

Closed
nkarri opened this issue Mar 14, 2018 · 32 comments
Closed

sudo n stable Error:: invalid version #492

nkarri opened this issue Mar 14, 2018 · 32 comments

Comments

@nkarri
Copy link

nkarri commented Mar 14, 2018

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
@shadowspawn
Copy link
Collaborator

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

@waffledonkey
Copy link

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"

@ghost
Copy link

ghost commented Apr 25, 2018 via email

@waffledonkey
Copy link

certainly

image

@projenix
Copy link

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

@shadowspawn
Copy link
Collaborator

@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?

@waffledonkey
Copy link

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

@shadowspawn
Copy link
Collaborator

shadowspawn commented Apr 29, 2018

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

@bill-bishop
Copy link

bill-bishop commented May 11, 2018

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

@waffledonkey
Copy link

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
}

and here's the equivalent with the variables substituted

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?

@Pyroseza
Copy link

I get this exact same error on CentOS

@jokeapart
Copy link

jokeapart commented Jun 4, 2018

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

@Pyroseza
Copy link

Pyroseza commented Jun 4, 2018

I can’t get that installed.

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

@Wayne529
Copy link

I had get the same wrong in Win10

@shadowspawn
Copy link
Collaborator

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/

@vyzaldysanchez
Copy link

Installing curl locally somehow fixed the issue for me... 😆

@byrenx
Copy link

byrenx commented Dec 13, 2018

@vyzaldysanchez what curl version are you using?

@brandoncordell
Copy link

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

@shadowspawn
Copy link
Collaborator

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?

@vyzaldysanchez
Copy link

@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...

@a3v0
Copy link

a3v0 commented Dec 30, 2018

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.

@a3v0
Copy link

a3v0 commented Dec 30, 2018

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
n@2.1.12 /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
n@2.1.12 /usr/local/lib/node_modules/n
root@silver:/home/howard# n stable
install : node-v11.6.0
Error: invalid version 11.6.0

@shadowspawn
Copy link
Collaborator

@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

@a3v0
Copy link

a3v0 commented Dec 31, 2018

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

@yathamravali
Copy link

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

@shadowspawn
Copy link
Collaborator

@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.)

@shadowspawn
Copy link
Collaborator

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.

@0xFFrancesco
Copy link

0xFFrancesco commented Feb 23, 2019

@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?

@shadowspawn
Copy link
Collaborator

@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

Repository owner locked and limited conversation to collaborators Mar 27, 2019
@shadowspawn
Copy link
Collaborator

shadowspawn commented Mar 27, 2019

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...

@shadowspawn
Copy link
Collaborator

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

@shadowspawn
Copy link
Collaborator

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests