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

npm run dev 打开网页登陆报 405 #2865

Closed
DarrenLuo opened this issue Dec 19, 2019 · 6 comments
Closed

npm run dev 打开网页登陆报 405 #2865

DarrenLuo opened this issue Dec 19, 2019 · 6 comments

Comments

@DarrenLuo
Copy link

Bug report(问题描述)

Steps to reproduce(问题复现步骤)

直接 npm run dev 后打开网页直接登陆会报405,method not allowed

Screenshot or Gif(截图或动态图)

image

Link to minimal reproduction(最小可在线还原demo)

Other relevant information(格外信息)

  • Your OS: macos 10.15.2
  • Node.js version: 12.12.0
  • vue-element-admin version: v4.0.0

需要将 main.js 中的

if (process.env.NODE_ENV === 'production') {
  mockXHR()
}

中的 if 部分去掉即可

@Tit1e
Copy link

Tit1e commented Dec 19, 2019

这个判断是生产环境启用mock,把 production 改为 development 就行了

@DarrenLuo
Copy link
Author

嗯,只是直接根据教程 git clone 下来之后再 npm run dev 无法使用会让一些新手懵逼

@roblues
Copy link
Contributor

roblues commented Dec 21, 2019

在main.js中,在下面这处把production改为development,因为在dev模式下,原来的代码没有启动mock
if (process.env.NODE_ENV === 'development') {
mockXHR()
}

@Sow-Hunter
Copy link

嗯,只是直接根据教程 git clone 下来之后再 npm run dev 无法使用会让一些新手懵逼

确实。对着教程来做,结果一直无法登录。对着 Google 搜了半天一直以为是 npm install 那步有问题,重试了好多次。教程对这块完全没有说明,对新人很不友好。

@yuwenyes
Copy link

yuwenyes commented Jan 4, 2020

注释了这个判断就可以了:if (process.env.NODE_ENV === 'production') {
“在main.js中,在下面这处把production改为development” 这个改法不可以---不知道为什么

@PanJiaChen
Copy link
Owner

#2929

重新拉取最新代码已修复。

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

6 participants