How to solve the problem of many errors in vue-element-admin npm install?

Original address: https://www.yii666.com/learning/vue/138.html

Step by step to solve the problem of many errors reported by vue-element-admin npm install

This article will step by step solve the problem of many errors reported during vue-element-admin npm install installation. Let's solve it one by one, and finally make it work.

Preliminary preparation


1.  Git  command line tool  to check the usage of git tool, click to view

2. Install  Nodejs

3. Install  npm  package management tool

The following are the versions of the tools used in this installation

How to solve the problem of many errors in vue-element-admin npm install?

The first step is to use Git to copy the project locally


Use the following command to copy the project. If the https address does not work, you can try ssh. If it still does not work, please check the  solution  . Do not copy the project repeatedly, just once.

 git clone https://github.com/PanJiaChen/vue-element-admin.git

or

git clone [email protected]:PanJiaChen/vue-element-admin.git

image.png

Step two, check the manual


The manual is a must-have for learning new knowledge and can basically solve most of your problems.

Manual location:

Gitee

Introduction | vue-element-admin

Github

Introduction | vue-element-admin

Solution that cannot be opened: Click to view

The third step is to install node-sass (please check the required version)


There are instructions in the manual, so it is also important to read the manual in the second step.

After installation, most of the problems can be solved. After installation, let's look at the fourth step to see if there are any other errors?

How to solve the problem of many errors in vue-element-admin npm install?

The fourth step is to start the formal installation and troubleshooting (an error is reported in the end)


1. First set up the domestic image, and then use the command to install it.

npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
npm install

Warning errors (npm WARN) can be ignored first, mainly npm fatal errors (npm ERR!)

2. The following error occurs during the installation process

   (1). If node-sass reports an error, use named installation and then re-npm install.

npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass

   (2) If other problems occur, repeat npm install.

// If the error is not repeated, install it multiple times.
npm install

   (3), error npm ERR! gyp ERR!, continue to execute npm install after running the command

npm install -g node-gyp

    

Step 4: Here are my steps to success


Prefix:

      System: Windows7

      Nodejs version v12

      Command tools: git, cmd, Visual Studio Code

step:

      1. Download via git clone

      2. I ran it several times according to the documentation on git and got an error (the command is as follows)

# 克隆项目
git clone https://github.com/PanJiaChen/vue-element-admin.git

# 进入项目目录
cd vue-element-admin

# 安装依赖,报错
npm install

# 安装依赖,报错
npm install --registry= 

# 多次安装 还是报错# 

npm install

      3. When running the installation command through local cmd, an error is still reported.

#cmd 运行安装命令还是报错
npm i

      4. Open VsCode, use the shortcut key, Ctrl + ~ to open the terminal, run npm i to install, successful ! ! ! ! ! !

Picture 1:

Step by step to solve the problem of many errors in vue-element-admin npm install

Picture 2:

Step by step to solve the problem of many errors in vue-element-admin npm install

Summarize the commands used


 
 
#查看版本
 git --version
 npm -v
 node -v
 
 #拷贝项目
 git clone https://github.com/PanJiaChen/vue-element-admin.git
 
 #拷贝完成后进入所在项目目录
 cd vue-element-admin
 
 #设置npm镜像为国内地址,并且进行安装
 npm install --registry=https://registry.npm.taobao.org
 
 # 过 Git  运行 npm install 有报错
 # 通过自带的 cmd  运行  npm i 有报错
 # 通过 Visual Studio Code 自带的终端,运行 npm i 竟然成功了!!!

Guess you like

Origin blog.csdn.net/qq_29639425/article/details/120907748