Vue-cli: vue configuration when behind proxy

Created on 6 Dec 2016  路  16Comments  路  Source: vuejs/vue-cli

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.

Most helpful comment

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.)_

All 16 comments

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

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

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

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?

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 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

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.

Maybe it will be useful someone

npm_config_strict_ssl=false vue init webpack my-project

@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 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.

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

@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.

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

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

@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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OmgImAlexis picture OmgImAlexis  路  3Comments

sanderswang picture sanderswang  路  3Comments

joshuajohnson814 picture joshuajohnson814  路  3Comments

b-zee picture b-zee  路  3Comments

DrSensor picture DrSensor  路  3Comments