Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running npm install - how to configure not to use SSH (port blocked by firewall)

When I run npm install the majority of modules are configured properly. However, at least one wants to hit an ssh:// address to pull the module. Unfortunately, my company has a policy not to allow SSH connections outside of the internal network.

The specific error I'm getting is:

Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://[email protected]/pemrouz/buble.git
npm ERR!
npm ERR! ssh: connect to host github.com port 22: Connection timed out
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128

I don't have buble defined in my package.json so it's obviously a library something else depends on.

Is there a way to configure NPM to NOT use ssh:// addresses? I assume I should be able to download the module(s) from an HTTP address like all of the others -- can I tell it to convert from SSH to HTTP always?

I've tried a few things I found online:

git config --global url."https://".insteadOf ssh:// and npm config set ssl-strict=false

These did not solve this particular problem.

like image 354
anthony_mcdougle Avatar asked Apr 06 '20 20:04

anthony_mcdougle


People also ask

Does npm use SSH?

[BUG] NPM v7 uses SSH instead of an explicit HTTPS for GitHub repos #2610.

Why npm install is not working?

If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).

What npm install does?

The npm install installs all modules that are listed on package. json file and their dependencies. npm update updates all packages in the node_modules directory and their dependencies.


1 Answers

I've tried a few things I found online:

git config --global url."https://".insteadOf ssh://

The actual command would be:

git config --global url."https://github.com".insteadOf ssh://[email protected]

Otherwise Git would try an URL like https://[email protected], which might not be well supported.

It npm still mentions SSH, then check the user running the npm command: it needs to the same as the one you did the global config.

like image 195
VonC Avatar answered Nov 15 '22 04:11

VonC