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

Use absolute version to install nightly and rc #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Use absolute version to install nightly and rc #40

wants to merge 1 commit into from

Conversation

cswl
Copy link

@cswl cswl commented Nov 22, 2017

Tested to install latest nightly.
The version_list code is copy pasta from nvm sauce with slight modification
However I couldnt copy pasta the nvm_download function.. which has lot of internal stuffs.
So, I just used curl for now.

EDIT: Rebased to update commit message.

$ nvm install nightly
Latest nightly: v10.0.0-nightly20171121a95d88c881
Downloading and installing node v10.0.0-nightly20171121a95d88c881...
Local cache found: $NVM_DIR/.cache/bin/node-v10.0.0-nightly20171121a95d88c881-linux-x64/node-v10.0.0-nightly20171121a95d88c881-linux-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v10.0.0-nightly20171121a95d88c881-linux-x64/node-v10.0.0-nightly20171121a95d88c881-linux-x64.tar.xz
npm WARN npm npm does not support Node.js v10.0.0-nightly20171121a95d88c881
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
Now using node v10.0.0-nightly20171121a95d88c881 (npm v5.5.1)
nightly -> v10.0.0-nightly20171121a95d88c881
Clearing mirror cache...
Done!

Alias seems to be fine too..

nvm list           
         v9.2.0
-> v10.0.0-nightly20171121a95d88c881
default -> stable (-> v9.2.0)
nightly -> v10.0.0-nightly20171121a95d88c881
node -> v9.2.0
stable -> v9.2.0

@cswl cswl changed the title Use absolute version to install nightly Use absolute version to install nightly and rc Nov 22, 2017
@lukechilds
Copy link
Owner

Thanks for working on this, you can piggy back on existing nvm code to list the remote versions by setting NVM_NODEJS_ORG_MIRROR and running nvm ls

e.g:

$ NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly/ nvm ls-remote
v0.10.41-nightly20151203036580393d
v0.10.42-nightly20160128b125512a5c
...
v9.1.1-nightly201711075f5ef4226e
v10.0.0-nightly20171126bb4462681c

@cswl
Copy link
Author

cswl commented Nov 27, 2017

Alright.. I will work on this tonight.. and rebase the PR

@cswl
Copy link
Author

cswl commented Nov 27, 2017

One issue I noticed is that, nvm ls-remote shows human -readable output... so if you have the latest nightly currently active it shows
-> v10.0.0-nightly20171126bb4462681c

So I need to handle that in parsing logic too.. :\

@cswl
Copy link
Author

cswl commented Nov 27, 2017

@lukechilds I felt copying the functions from nvm was easier.. than handling different cases for ls-remote.
Tested and working.

@lukechilds
Copy link
Owner

I've re-used nvm functions wherever possible to keep the codebase to minimum and reduce code duplication.

It should be fairly simple to parse nvm ls-remote output, you just need to check for the first occurrence of v and then capture that and all chars after it until you hit a whitespace char.

@cswl
Copy link
Author

cswl commented Nov 28, 2017

@lukechilds I've used nvm ls-remote and pattern matching version..
However, I'm getting this error when I have already installed the latest nightly..

Latest nightly: v10.0.0-nightly201711274ca4db0d4c.
grep: Unmatched [ or [^
awk: cmd. line:3: (FILENAME=- FNR=1) fatal: Unmatched [, [^, [:, [., or [=: /v10.0.0-nightly201711274ca4db0d4c/
grep: Unmatched [ or [^
awk: cmd. line:3: (FILENAME=- FNR=1) fatal: Unmatched [, [^, [:, [., or [=: /v10.0.0-nightly201711274ca4db0d4c/
Version 'v10.0.0-nightly201711274ca4db0d4c' not found - try `nvm ls-remote` to browse available versions.
Clearing mirror cache...
Done!

Installing the nighltly from scratch works fine.. I guess we could check whether the installed version is latest by ourselves instead of calling nvm install..

Sigh..

@lukechilds
Copy link
Owner

Does this definitely resolve the problem for you? I still get the nightly aliases:

$ nvm install nightly
Latest nightly: v10.0.0-nightly20171130701dc9a86e.
Downloading and installing node v10.0.0-nightly20171130701dc9a86e...
Local cache found: $NVM_DIR/.cache/bin/node-v10.0.0-nightly20171130701dc9a86e-darwin-x64/node-v10.0.0-nightly20171130701dc9a86e-darwin-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v10.0.0-nightly20171130701dc9a86e-darwin-x64/node-v10.0.0-nightly20171130701dc9a86e-darwin-x64.tar.xz
npm WARN npm npm does not support Node.js v10.0.0-nightly20171130701dc9a86e
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
Now using node v10.0.0-nightly20171130701dc9a86e (npm v5.5.1)
nightly -> v10.0.0-nightly20171130701dc9a86e
Clearing mirror cache...
Done!

$ nvm ls
         v4.8.4
        v5.12.0
        v6.11.3
         v8.4.0
         v8.5.0
         v8.6.0
         v9.2.0
-> v10.0.0-nightly20171130701dc9a86e
         system
default -> node (-> v10.0.0-nightly20171130701dc9a86e)
nightly -> v10.0.0-nightly20171130701dc9a86e
node -> stable (-> v10.0.0-nightly20171130701dc9a86e) (default)
stable -> 10.0 (-> v10.0.0-nightly20171130701dc9a86e) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> N/A)
lts/argon -> v4.8.6 (-> N/A)
lts/boron -> v6.12.0 (-> N/A)
lts/carbon -> v8.9.1 (-> N/A)

@cswl
Copy link
Author

cswl commented Dec 1, 2017

You have to manually clear the alias if you once used the older hack.

nvm ls
         v4.8.6
        v6.12.0
         v8.9.1
->       v9.2.0
v10.0.0-nightly201711274ca4db0d4c
default -> stable (-> v9.2.0)
nightly -> v10.0.0-nightly201711274ca4db0d4c
node -> v9.2.0
stable -> v9.2.0
iojs -> N/A (default)
lts/* -> lts/carbon (-> v8.9.1)
lts/argon -> v4.8.6
lts/boron -> v6.12.0
lts/carbon -> v8.9.1

POSIX sed doesn't do non-greddy match so we just pipe it to awk.
This will handle cases when the latest nighlty version is installed or not.

Command tested with.

echo "v10.0.0-nightly20171126bb4462681c            (test)"  \
	| sed -n "s/.*\(v.*\)/\1/p" | awk '{print $1}'

echo "-> v10.0.0-nightly20171126bb4462681c            (test)"  \
	| sed -n "s/.*\(v.*\)/\1/p" | awk '{print $1}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants