Cause analysis of server access failure in vue project online

  • 2021-08-06 20:27:07
  • OfStack

Shan Meier encountered a wonderful problem. Let's share it with the big guy. First of all, because of the project I just took over, I don't have the connection information of the online server. I packed the front-end codes for others, and others sent them to the server, but they couldn't be accessed to the online server. This is the problem in the middle.

So-called, packaging is the concept of compression, and compressed files compressed again will lead to the multiplication of files, which in the middle of a lot of problems, we ruled out a lot of problems did not find the reason, then I thought about taking U disk copied 1 try again, the result was successful! ! ! ! !

According to Shan Mei son many years of experience to analyze, with U disk directly copied is the source file, and compressed the past compressed package decompression, it is not the original file! Well, that should be the reason. . . . . .

Additional knowledge: When the vue project cannot be accessed using ip address and port number

Modify dev attribute under scripts attribute in package. json file

Add host 0.0. 0.0 before restarting the server


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

Related articles: