lukechilds / zsh-nvm

Zsh plugin for installing, updating and loading nvm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to install nightly

FallingSnow opened this issue · comments

$ nvm install nightly         
Version 'node' not found - try `nvm ls-remote` to browse available versions.
Clearing mirror cache...
Done!

Let me know if you need any more information.

Thanks for reporting.

I'm not quite sure why this has broken, possibly the format of https://nodejs.org/download/nightly/ has changed, although that seems unlikely.

Or possibly nvm has changed the way it parses versions, as it seems to be interpreting the nightly versions as iojs.

$ NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly/ nvm install node
Version 'node' not found - try `nvm ls-remote` to browse available versions.

$ NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly/ nvm ls-remote
    iojs-v1.0.0
    iojs-v1.0.1
    iojs-v1.0.2
    iojs-v1.0.3
    iojs-v1.0.4
    iojs-v1.1.0
    iojs-v1.2.0
    iojs-v1.3.0
    iojs-v1.4.1
    ...
    iojs-v3.3.1

I was able to install nightly via v8-canary: NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/v8-canary nvm install node.

Hmmnn, seems to just be that by chance it's parsing a couple of the v8-canary listings as node instead of iojs:

$ NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/v8-canary/ nvm ls-remote
v9.0.0-v8-canary201710301f8f3dcf36
v10.0.0-v8-canary20180321f7efae222a
    iojs-v1.0.0
    iojs-v1.0.1
    iojs-v1.0.2
    ...
    iojs-v3.3.1

Unfortunately I don't really have the time to look into this further right now. PRs welcome!

I think the best solution would either be to remove this feature completely (it was always a bit of a hack), or add our own version parsing that properly detects canary/nightly/rc versions.

The latter would need to be done very carefully to avoid any breakage and not mess things up with nvm. It should probably be submitted as a PR to nvm rather than to zsh-nvm if the maintainers want it.

I agree. I believe this is a feature that should be in nvm, not zsh-nvm. Unfortunately I doesn't seem like a priority to them.

commented

@lukechilds
I stopped messing with nightly node... so I didnt notice this yet...

I can write our own nightly/rc installer which parses the stuff..
which uses absolute versions and doesnt interfere with stable nvm installs...

I will get around to writing this tonight..

That would be amazing, I think it's a fairly big job though.

If you're serious about doing this it might be worth contributing it upstream, directly to nvm. Then everyone can benefit, not just users of zsh-nvm. It would probably be worth creating an issue there first and letting them know what you're planning, just to make sure they definitely want it.

commented

So I took a look at why it's parsing nightly versions as iojs...

+nvm_ls_remote_index_tab:91> VERSIONS='' 
+nvm_ls_remote_index_tab:104> [ -z '' ']'
+nvm_ls_remote_index_tab:105> nvm_echo N/A
+nvm_echo:1> printf '%s\n' N/A
+nvm_ls_remote_index_tab:3> [ 3 -lt 3 ']'
+nvm_ls_remote_index_tab:8> local FLAVOR
+nvm_ls_remote_index_tab:9> FLAVOR=iojs 

It fails to parse VERSIONS and return N/A.. https://github.com/creationix/nvm/blob/bc87d3dd1c380298be2d624331bc83578255f5f9/nvm.sh#L1083

The checking logic in https://github.com/creationix/nvm/blob/bc87d3dd1c380298be2d624331bc83578255f5f9/nvm.sh#L512
Causes it to get detected as iojs..

Unfortunately the parsing logic is written in awk which I don't have much knowledge..
I will need to learn it before I can work in this..