Error reporting when installing and running vue-element-admin-solution

1. The original installation method - error

The official website installation link is as follows:
https://panjiachen.gitee.io/vue-element-admin-site/zh/guide/#%E5%AE%89%E8%A3%85

The errors I encountered are mainly in the following stages:

  1. After git clone in the installation link above, npm install cannot be installed
  2. After npm install is completed, it cannot be started, that is, npm run dev fails

After searching various information on the Internet, the installation was completed and successfully operated on 2022.11.20 .
The solutions to the errors in these two phases are documented below.

2. npm install cannot be installed

I have no record of the error message.
There are 2 solutions. The recommended method 2 is easier.

1. Method 1

Click the link below, in the file after git clone and cd, after modifying according to the blogger's 3 steps, npm install can be successful.
https://gitee.com/panjiachen/vue-element-admin/issues/I4UQ2X

insert image description here

2. Method 2

Click the link below to directly download the blogger’s repair file for npm install, then npm install
https://gitee.com/constfiv/vue-element-admin-fix-install-problem
Advantages:
No need to modify it yourself in method 1 The 3 steps of the file, you can npm install after downloading
(this link file is the file repaired by the blogger in method 1)

3. npm run dev failed and the project could not be started

After npm install succeeds, npm run dev reports an error:

npm ERR! [email protected] dev: vue-cli-service serve

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-admin-template@4.4.0 dev: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-admin-template@4.4.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I refer to the following solutions, the project [still cannot start]:
1. Uninstall and reinstall webpack-dev-server
2. In babel.config.js, modify presets
3. Open in vue.config.js :true comment out

√√Final workaround:

=>Reduce the node version.
The node version in my computer should be 16.18.0, which may be too high for the vue-element-admin file.
Lowering the node version refers to the method mentioned by this blogger
https://github.com/PanJiaChen/vue-element-admin/issues/4054

Precautions:
=> Method to reduce the node version
(1) Method 1 (not recommended)
Use the nvm management tool to reduce the node version,
but I failed to install node according to the blogger’s method, that is, install it according to its corresponding steps When nvm and node-specific version numbers (for example: nvm install 12.17.0) and nvm use node 12.17.0 succeed, the error "npm ERR! errno -4048" is reported after entering the command node -v , and then try based on this error report The solutions (such as modifying system variables, etc.) were unsuccessful, so choose method 2 below to reinstall node.

(2) Method 2 (recommended)
It is recommended to reinstall node, first clear the node installed on the computer (this step can refer to this article )
√The operation steps of reinstalling node, I refer to the node installation method of the following blogger , the installation was successful
https://blog.csdn.net/qq_48485223/article/details/122709354
√Because I need to reduce the node version, I chose to install node 12.13.0 version, node-v12.13.0-x64.msi , click You can download a specific version of node from the link on the left. After installation and configuration, you can enter node -v to check the version number.

4. Successful operation process

My successful operation steps are summarized as follows:
If you also encounter the error reporting in <2> and <3> in this article, you can follow the steps below

  1. Download the npm intsall repaired file directly, the link is as follows: https://gitee.com/constfiv/vue-element-admin-fix-install-problem
  2. Reinstall node and install a lower version of node. For the steps, see method 2 of <3> in this article
  3. VS Code opens the file downloaded in step 1, and enter npm install in the terminal (the network speed may be a bit slow)
  4. Enter npm run dev, the project starts successfully

Postscript:
I originally wanted to install and successfully run vue-element-admin at 23 o'clock in the evening on November 19, 2022, so I took a rest early. As a result, I dealt with various error reports until 3 o'clock in the morning. I will deal with it again in the next day, but I still don’t give up. I thought that trying a new method should solve the problem, but the problem was not solved until 3:00 am on November 20, 2022 (the problem was stuck when nvm installed the lower version of node), helplessly I had to rest, feeling very depressed, and dreaming was all about lowering the node version (emmm, I know my mentality still needs to be adjusted).
I got up at 9 am and reinstalled node, then successfully ran the project and wrote this article.
I hope the solution in this article can help other friends.

Guess you like

Origin blog.csdn.net/qq_42376600/article/details/127945498