[HPM] Error occurred while trying to proxy request /login/account from localhost:8000 to localhost:8888/api/ (ENOTFOUND) (https://nodejs.org/api/errors.html#errors_c
ommon_system_errors)
antd pro 2.0 前端服务器代理,出现该错误。
原因:target地址上没写http协议。
错误写法:
proxy: {
‘/api’: {
target: ‘localhost:8888/api/’,
changeOrigin: true,
pathRewrite: { ‘^/api’: ‘’ },
},
正确写法:
proxy: {
‘/api’: {
target: ‘http://localhost:8888/api/’,
changeOrigin: true,
pathRewrite: { ‘^/api’: ‘’ },
},
注意:
- 使用
npm run start:no-mock
启动后,一定要保证你的后端服务也是启动的。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)