Reputation: 843
For a brief introduction, I have automated builds that install dependencies from NPM to run some analysis on them. So it is important to consider that, after running npm install
, the application doesn't even need to work, I only need the dependencies.
To keep it simple, let's say my dependencies
from package.json looks like this (there are actually more dependencies but they aren't important) :
"dependencies": {
"pdf2json": "git://github.com/jmdeejay/pdf2json.git#a384122f",
"phone": "~2.3.7",
},
phone
can be installed without any problem, but pdf2json
isn't.
When I run npm install
, I get the following error :
[10:21:19][Step 1/4] npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t git://github.com/jmdeejay/pdf2json.git
[10:21:19][Step 1/4] npm ERR!
[10:21:19][Step 1/4] npm ERR! fatal: unable to connect to github.com:
[10:21:19][Step 1/4] npm ERR! github.com[0: 192.30.253.112]: errno=No such file or directory
[10:21:19][Step 1/4] npm ERR! github.com[1: 192.30.253.113]: errno=No such file or directory
[10:21:19][Step 1/4] npm ERR!
[10:21:19][Step 1/4] npm ERR!
[10:21:19][Step 1/4] npm ERR! exited with error code: 128
I believe it might be related to the firewall of the build server or some configuration of the said server, but this is not the problem I would want to address.
I've looked at the npm-config and npm install documentation but I couldn't find a flag for what I want. I'd like to know : Is there a way to skip dependencies from other sources than NPMrepository or to continue the dependencies installation when one of them fails?
I don't need to analyze this package as it indirectly belongs to my organization, so I would be perfectly fine with skipping it, but I can't simply remove it from the package.json
because it is used to really install the application in other scenarios.
Edit
There's a comment that states using git://
might not be a good solution, but according to NPM documentation, this should work. The following screenshot comes from the npm documentation, and the fourth line matches my configuration
I can confirm that git://
isn't a typo, it is typed this way in the package.json
of a project that is working. I also don't have the opportunity to change this configuration file as I do not have ownership of this project.
Upvotes: 1
Views: 1848
Reputation: 843
It feels awkward answering my own question but I found a solution with the help of @evolutionbox's comment.
I couldn't modify the package.json
file, but I ended up doing this in my script:
git config --global url."https://".insteadOf "git://"
npm install
git config --global url."git://".insteadOf "https://"
This way, I temporarly change my configuration to something that works (even though, according to npm's documentation, git://
should work)
Upvotes: 1