SoFunction
Updated on 2025-04-04

Analysis of the reasons why online server access failed for vue project

Shan Mei'er encountered a strange problem. She shared it with everyone. First of all, because of the project I just took over, I don't have the connection information for the online server. The front-end code was packaged for others. Others passed it to the server, but it could not be accessed when it was transmitted to the online server. This is a problem.

As the saying goes, packaging is the concept of compression, and compressing the compressed file will cause the file to grow exponentially, and many problems arise in the middle. We eliminated many problems but couldn't find the reason. Later, I thought about copying the USB flash drive and then trying, but it was successful! ! ! ! !

According to Shan Meier's years of experience, the source file is copied directly using the USB flash drive, and the compressed package passed through and then decompressed is not the original file! Well, that's probably the reason. . . . . .

Supplementary knowledge:When the vue project cannot be accessed using the IP address and the port number

Modify the dev attribute under the scripts attribute of the file

Add –host 0.0.0.0 and restart the server

 "scripts": {
  "dev": "webpack-dev-server --host 0.0.0.0 --inline --progress --config build/",
  "start": "npm run dev",
  "lint": "eslint --ext .js,.vue src",
  "build": "node build/"
 }

The above analysis of the reasons why the online server access failed in the vue project is the entire content shared by the editor. I hope it can give you a reference and I hope you can support me more.