Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

项目跑起来了,但是登录接口报504,登录不了 。 #8

Closed
oo10 opened this issue Jun 21, 2017 · 9 comments
Closed

项目跑起来了,但是登录接口报504,登录不了 。 #8

oo10 opened this issue Jun 21, 2017 · 9 comments

Comments

@oo10
Copy link

oo10 commented Jun 21, 2017

$ npm run dev

vue-koa-demo@1.0.0 dev C:\Users\Administrator\Desktop\2017.6\vue-koa-demo
node build/dev-server.js

[HPM] Proxy created: /auth -> http://localhost:8889
[HPM] Proxy created: /api -> http://localhost:8889

Starting dev server...
DONE Compiled successfully in 8258ms12:41:49

Listening at http://localhost:8080

[HPM] Error occurred while trying to proxy request /auth/user from localhost:8080 to http://localhost:8889 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)

配置了自己的mysql密码,这是什么原因导致的呢。

@oo10 oo10 changed the title mysql和koa项目跑起来了,但是登录接口报504,登录不了 。 项目跑起来了,但是登录接口报504,登录不了 。 Jun 21, 2017
@oo10 oo10 closed this as completed Jun 21, 2017
@Gala-1024
Copy link

你好。我也遇到这个问题,请问你怎么解决的?

@michwh
Copy link

michwh commented Feb 20, 2018

我也是,请问你们是怎么解决的 @cgygd @oo10

@YuFengDing
Copy link

你们解决了吗 - -

@Molunerfinn
Copy link
Owner

@YuFengDing 你的.env文件长什么样?

@YuFengDing
Copy link

your database username

DB_USER=root

your database

DB_PASSWORD=''

Koa is listening to this port

PORT=8889

@Molunerfinn
Copy link
Owner

@YuFengDing
如果是在windows下运行的话,需要分开运行前端和后端:

npm run dev

然后在另一个窗口运行

npm run server

分开查看两个窗口的报错信息。如果run server的后端报ECONNREFUSED的错误一般是你的8889端口被占用了。要么换一个端口要么杀掉之前8889端口的进程。然后重新跑一遍npm run server

@YuFengDing
Copy link

@Molunerfinn 我把两个端口前台和后台都换了 但是请求的时候现在爆出 500

@Molunerfinn
Copy link
Owner

Molunerfinn commented Apr 12, 2018

@YuFengDing 改了后端的端口的话你需要把proxyTable里的端口也换成跟Koa的端口一致:
https://github.com/Molunerfinn/vue-koa-demo/blob/master/config/index.js
image
如果都换了还是有报错注意看后端的报错信息,看看是啥报错。另外改了配置之后都需要重新把两个命令都跑一遍。

@YuFengDing
Copy link

@Molunerfinn 看到具体报错了
image 貌似是db连接问题 我在看一下 感谢指导

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants