coreybutler / nvm-windows

A node.js version management utility for Windows. Ironically written in Go.
MIT License
37.38k stars 3.33k forks source link

Installing node versions from local file location #229

Open nmstoker opened 7 years ago

nmstoker commented 7 years ago

Is there a straight-forward way to run nvm-windows where it grabs the installer from a specified local file location?

The use-case for this is on a server or regular PC without internet access (ie one that's at least somewhat locked down or potentially just offline, like schools in remote locations). Although the download part would then not function, the remaining nvm functionality is still really useful.

If it's not practical to do as the tool currently stands, I presume this might be better classified as an enhancement request. I did look through existing issues and on Stack Overflow but didn't see anything that looked like it covered this.

Even if this can't be done and it's not accepted as a feature enhancement, nvm-windows is great, so a big thank you whatever the outcome!


BTW: just a small unrelated side-point, but the issues boilerplate includes a URL for the Stackoverflow page for NVM4W, but right now there seem to be no questions at all tagged with the tag given in the link (basically it looks like a load of people just tag them as [nvm] and [windows]; perhaps they're technically wrong, but it might work better if the URL were http://stackoverflow.com/questions/tagged/nvm+windows )

coreybutler commented 7 years ago

@nmstoker - Thanks for the SO tip too. At the moment, the short answer is no.

There is a possible workaround if your local environment is capable of running a web server to host the Node/npm installation files. You could setup a mirror server. nvm-windows supports mirroring in the master branch. However; if there is no internet access, the nvm list available command will not work because there is no mirroring capability for the list of available installations.

This is an interesting use case that piques my interest. My immediate gut reaction says the nvm-windows client may not be the right place for this functionality, but it seems like a use case that merits attention. A separate tool, such as a local mirroring server (something I've been toying around with already), may be a more appropriate fit. There are reasonably simple ways to setup a basic mirror, but I can already think of several maintenance & management headaches that would be much better handled outside of this project. If this is something you'd be interested in discussing, I'd be happy to do so privately.

nmstoker commented 7 years ago

Thanks for the details @coreybutler Now you mention it, a separate tool may well make more sense. I haven't looked into mirror servers properly, but with the flexibility it gives for installing npm modules offline too, this may well be the way to go (although I'm on a fairly tight timeline, so whilst not averse to discussing it further, I'm unlikely to be able to do much in the near term)

martin-sweeny commented 6 years ago

Being able to install node from a local file would be super useful. At my office, the terminal is behind a firewall so nvm cannot download anything; whereas my browser does have internet access.

jbialas-bb commented 5 years ago

I wouldn't call this an edge case. If you want to use this in an enterprise environment or behind firewalls, you want to know exactly what is getting installed so reaching out to a server is a no-go.

I also strongly disagree that it should be a separate tool. What's the difference between reading from a webserver vs the local file system? It's a gross hack if I need to set up a local file server to provide a mirror.

coreybutler commented 5 years ago

First, if you can access the web via a browser, but not the terminal, then the browser is most likely to be configured to use a proxy. NVM4W supports proxies.

The other issue isn't whether the utility reads from disk or an HTTP stream. The issue is metadata management. All of the major version managers rely on Node's release list, since it is the authoritative source of which versions are available. This includes detail about which version of npm is packaged with each version of node, the latest/stable/current/lts/boron/etc releases, what is and isn't approved for release and so forth. It's alot of maintenance. This is exactly why Node mirroring is available, and why it will never be a part of the version management CLI utility. There is value in a local/LAN distribution environment, I fully recognize that, but it is quite a bit involved than just plunking files into a folder. There needs to be separation of concerns in order to make it managable.

To be brutally honest, I'm not exactly motivated to push forward on an open source Node distribution platform for enterprise use. I am the only one working on this project, half of the whopping $10 patronage comes from one individual, and I'm just not motivated to make enterprise software for free. That said, I have been discussing enterprise solutions with several organizations, because again, I absolutely see the DX value (and it's an interesting domain). I do see a future with more environment management, more in-house control of resources, etc.... but most likely as paid product offerings. Otherwise, setting up an internal mirror isn't really that complex.

If you're an individual who can't control the enterprise environment, Fenix Web Server may help. It was built for these kinds of situations. Setting up a mirror would be pretty straightforward (especially with v3).... visual, drag 'n' drop, but still gives you control to modify what is/isn't served.

liudonghua123 commented 4 years ago

Is there any cache directory I can put the downloaded setup executable like https://nodejs.org/dist/v14.8.0/win-x64//node.exe file (maybe rename it to add the version, arch info). Then install from it other than download it again. This would be nice and easy for offline installation.

coreybutler commented 4 years ago

@liudonghua123 no, but a proxy might be able to do caching. In other words, setup a proxy pointing to the official Node distributions and point NVM4W to the proxy. The first time an installer is requested it will be downloaded, but anything beyond that could be delivered from your LAN.

Charsnows commented 5 months ago

I have encountered the same problem. Do you have any solution now? Thanks.