First of all I want to clarify that I am from Cuba and here the internet is super expensive, costing $1 per hour and that is why I am asking this question. I know that node packages are usually installed very easily by their respective commands and everything works very well and great but you have to have an internet connection.
I would like to know, please, if someone knows how to download the node packages so that I can install them without an internet connection on my computer It should be noted that the computer on which I write is not my personal PC so I need to be able to download them for later and install them without internet connection. I am using a proxy for internet connection.
I would be very grateful if someone helps me and explains step by step how to make this possible, you can't imagine how much I would appreciate it. Thank you very much in advance.
You have to download the modules at least once and it depends on which module you are dealing with (ie require compilation as
node-sass
).If the module is cached and not too old you can do the full offline installation. For example if you create an express application you could install its dependencies next while offline because all the modules it requires and their dependencies are cached. You should keep in mind that this is not 100% secure since:
For situations like this it is a very good idea to create or install the modules that you use often even if you are not going to use them so that the cache stays fresh. If you move from workstation you should take the folders
npm
andnpm-cache
that are in~\AppData\Roaming\
if you were working on Windows and~/.npm
Linux. If they are not found in that route, you can execute the command,npm config ls -l
this will show you the general configuration and within it where the cache is stored, which will show something likecache = la_ruta_de_tu_cache
The alternative may be to mount a server and clone the entire npm repo but this could be even more of a problem as the repo is huge and will end up costing you a lot more to download and maintain than installing a particular project which only requires a single install. time. You could talk to a friend who comes from abroad to download it there and provide it to you but it is still a temporary solution since npm updates its content constantly and your projects will quickly become outdated.
As the best and last option you can use a repository manager like artifactory that integrates with npm and maintains the modules in a more persistent way as you download them, which allows the cost of internet access to be minimal but of course you have to download the packages at least once. There is a video on the page itself that explains how to set it up.
Exactly the same thing happens to me, I'm from Cuba, and at first I didn't know how to do it, but it's super easy.
You just have to create a folder in your directory, where you are going to create your program. node_modules/ Inside the folder, you can put the modules, and then call them normally: That way you can run it. But if it still doesn't work, you'll have to call the module, locally putting its address after, require('./node_modules/example/Index.js)'); If you want to use express, you will have to put all the modules locally, and so on. It took me about 3 days to be able to do everything