【问题标题】:'npm run eject' error 'missing script: eject' in react'npm 运行弹出'错误'缺少脚本:弹出'反应
【发布时间】:2020-08-28 04:54:02
【问题描述】:

我使用 npm create-react-app 创建一个新的应用程序 这是我的 package.json 文件

  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

这是错误代码:

npm run eject
npm ERR! missing script: eject

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\acmilanyjguo\AppData\Roaming\npm-cache\_logs\2020-08-28T04_26_15_274Z-debug.log

这是日志文件:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'eject'
1 verbose cli ]
2 info using npm@6.14.5
3 info using node@v12.18.2
4 verbose config Skipping project config: C:\Users\acmilanyjguo/.npmrc. (matches userconfig)
5 verbose stack Error: missing script: eject

我无法运行弹出,找不到原因。我想知道原因,谢谢。

【问题讨论】:

  • 你能澄清一下其他 npm 命令是否对你有用吗? npm run start
  • 您能否确保您在与您的package.json 文件相同的目录中运行npm run eject
  • 找到原因:无法运行npm run start解决问题后,现在可以运行eject了。
  • @MaomaoYi 你是怎么解决这个问题的?

标签: reactjs


【解决方案1】:

我遇到了同样的问题。 你必须检查你的构建在哪里。

如果它在您的 前端 上,则 cd frontend 并提示 npm run eject 如果它在您的后端中,那么在backend 和提示npm run eject

对我来说,构建是在 frontend 包中,我在后端提示,因为它不工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-30
    • 2017-11-15
    • 2023-03-05
    • 2018-05-24
    • 1970-01-01
    • 2020-08-14
    • 2018-12-29
    • 2018-09-03
    相关资源
    最近更新 更多