vue-cli icon indicating copy to clipboard operation
vue-cli copied to clipboard

vue configuration when behind proxy

Open tomvdk opened this issue 9 years ago • 16 comments

Hi,

We are having lots of trouble configuring the vue-cli. We are behind a proxy and get the following error when installing a template:

vue-cli · Failed to download repo vuejs-templates/simple: unable to verify the first certificate

We think this is due to our proxy and misconfiguration of our gitconfig. Also, our proxy has a certificate configured. Does anyone know, how to troubleshoot this because I find this very cumbersome.

Our .gitconfig file looks like this:

# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
name = myusername
email = [email protected]
[http] 
sslVerify = false 
	proxy = http://<username>:<password>@<proxy>:8080
[https] 
[url "https://github.com/"]
insteadOf = git://github.com/

Thanks a lot in advance.

tomvdk avatar Dec 06 '16 14:12 tomvdk

It has actually nothing to do with your gitconfig. Your proxy is actually an insecure man in the middle... Not verifying the ssl certificate is a bad idea.

To debug further this problem you should check https://github.com/flipxfx/download-git-repo/blob/master/package.json and its dependencies. That's what vue-cli uses under the hood to fetch the template

posva avatar Dec 09 '16 12:12 posva

Thanks a lot for pointing this out. I'll investigate the dependencies.

tomvdk avatar Dec 09 '16 20:12 tomvdk

download-git-repo should allow passing options to download/got so we could use these proxy settings.

Akryum avatar Dec 12 '16 12:12 Akryum

I'm able to clone from git manually, but when trying to vue init a template, I get "unable to get local issuer certificate." I've already added our cert similar to this vscode/git issue method and I've added our proxy in the config for node/git.

Is there an avenue to config vue-cli or the under-the-hood download-git-repo to cooperate with our proxy?

Jecoms avatar Dec 20 '16 17:12 Jecoms

For anyone still having issues with this here's a band-aid fix:

git clone https://github.com/vuejs-templates/simple ~/.vue-templates/simple
vue init simple my-project --offline
cd my-project
npm install
npm run dev

So like the commenters git works fine by itself, so clone the template you want into your HOME/.vue-templates folder, then use the --offline switch to skip the non-functioning git clone that vue-cli uses. Then npm install works just fine and you are ready to go.

(NOTE: If you are on Windows machine using cmd, you'll need to change your folder commands appropriately.)

traeblain avatar Aug 25 '17 19:08 traeblain

@traeblain Thanks for sharing. Windows example: git clone https://github.com/nuxt-community/starter-template.git C:\Users\niallobrien\.vue-templates\nuxt-starter-template - just swap out the username for example

niallobrien avatar Aug 28 '17 09:08 niallobrien

Thanks! Worked for me on my corporate Windows machine. Had to set some env variables, like HTTPS_PROXY to point at our proxy server, but after that it worked.

grunlowen2 avatar Oct 20 '17 14:10 grunlowen2

Maybe it will be useful someone

npm_config_strict_ssl=false vue init webpack my-project

artzub avatar Dec 09 '17 07:12 artzub

@yyx990803 not sure why you're closing this out... it is an issue that is not resolved. The workaround @traeblain specifies is the only method for some of us using corp proxies with man-in-the-middle certs.

kreig303 avatar Feb 06 '18 20:02 kreig303

@kreig303 unfortunately, we will no longer be adding new features to vue-cli 2.x. We will try to address this if the similar issue persists in 3.0.

yyx990803 avatar Feb 06 '18 20:02 yyx990803

hi @traeblain, where can I find the HOME/.vue-templates folder? or anyone knows.

xjojoramirez avatar Mar 01 '18 02:03 xjojoramirez

@Mojoejojo you may have to create it, or let git create it when you clone.

If you are on Linux create ~\.vue-templates if you are on Windows create C:\Users\USER\.vue-templates where USER is specific to your user folder.

traeblain avatar Mar 01 '18 14:03 traeblain

this works

git clone https://github.com/vuejs-templates/webpack ~/.vue-templates/webpack
vue-init --offline webpack nongcaiyuan-front
cd my-project
npm install
npm run dev

netqyq avatar Mar 02 '18 11:03 netqyq

In my case helped a strange solution - I updated git and disabled Kaspersky mall Office Security (I work on windows)

Gargo avatar Jul 15 '18 10:07 Gargo

@traeblain

For anyone still having issues with this here's a band-aid fix:

git clone https://github.com/vuejs-templates/simple ~/.vue-templates/simple
vue init simple my-project --offline
cd my-project
npm install
npm run dev

So like the commenters git works fine by itself, so clone the template you want into your HOME/.vue-templates folder, then use the --offline switch to skip the non-functioning git clone that vue-cli uses. Then npm install works just fine and you are ready to go.

(NOTE: If you are on Windows machine using cmd, you'll need to change your folder commands appropriately.)

this works

charlesx163 avatar Jul 20 '20 09:07 charlesx163

this works

git clone https://github.com/vuejs-templates/webpack ~/.vue-templates/webpack
vue-init --offline webpack nongcaiyuan-front
cd my-project
npm install
npm run dev

This works

felix-cao avatar Nov 03 '20 11:11 felix-cao