Vue init webpack Error: unable to verify the first certificate

When initializing the webpack project with Vue cli, use the following commands:

$ vue init webpack [project-name]

After setting up the agent of NPM and modifying the domestic image warehouse, an error is still reported. The error information is as follows:

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

According to the information, the reason for this problem is that we use the proxy server, so Vue cli cannot verify the proxy server certificate when downloading the webpack template, so this error is reported
to solve this error, one way is to turn off the verification of SSL certificates. However, this method is not valid for everyone, and the following method is only used when your proxy server is trusted:

$ npm config set npm_config_strict_ssl=false

If this method doesn’t work, another way is to use the offline method to initialize the Vue project.

Clone the webpack template project to the local C:\users [username]. Vue Templates folder. If there is no such folder, create one. The folder starting with. Cannot be created in windows. You can use CMD or PowerShell to switch to the C:\users [username]\directory and enter the following command to create the folder:

$ mkdir .vue-templates

The download address of the webpack template is: vuejs templates. Select the required template to clone. I select the complete webpack template here. You can clone the project to the folder we created in the previous step through the following command (provided that git Bash is installed):

$ git clone https://github.com/vuejs-templates/webpack ~/.vue-templates/webpack
    1. If Git is not installed, you can also directly download the project in the form of zip on the GitHub and extract it into. Vue templates. Generally speaking, if the clone speed of Git is too slow, you can also directly download and extract the zip in step 3 in addition to setting the agent… Rerun the command of Vue to initialize the project. Note that the offline mode is
$ vue init webpack [project-name] --offline
$ cd [prject-name]
$ npm run dev

Read More: