Well, for some reason npm cache works not as expected and cache hits are low. m, -internal-port HTTPs port to use for internal proxying "MITM" server (necessary for running on Windows systems) n, -metadata-excluded Exclude metadata requests from caching Setting Npm Proxy Settings From your command prompt, you can type in the following command to check the current npm settings. f, -friendly-names Use actual file names instead of hashes in the cache You need to set the https-proxy, proxy and registry to install the dependencies. expired Use expired cache when npm registry unavailable Overriden using command line options: npm-proxy-cache -help Once you have npm configured, start the proxy: npm-proxy-cacheīy default proxy starts on localhost:8080 and have cache ttl 30 mins. Requests are not cached, so you still be able to publish your modules to npm registry without The strict-ssl false option is required since it's impossible to auth cached responseįrom https proxy, which actully acts as a MITM (man in the middle). To pass parameters, simply append them to the docker run command, like so: docker run -t npm-proxy-cache -port 8080 -host 0.0.0.0 -expiredįirst of all, you need to configure npm to use proxy npm config set proxy npm config set https-proxy npm config set strict-ssl falseĪnother way is to use it explicitly with npm install command, like this: npm -proxy -https-proxy -strict-ssl false install To review, open the file in an editor that reveals hidden Unicode characters. Īfter building the image successfully, you can run the Docker container. npm config get proxy This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To run npm-proxy-cache as a Docker container, you need to build the image first: docker build -t npm-proxy-cache. The docker image of this repository is not hosted on Docker Hub (yet) Installation npm npm install npm-proxy-cache -g Other solutions such as local CoachDB mirror of npm registry require much You may find this tool useful if you are experiencing huge network lags / latency HTTP/HTTPS caching proxy for work with npm utility.
0 Comments
Leave a Reply. |