【问题标题】:I get this list of errors when I use the npm start command on my react project当我在我的 React 项目上使用 npm start 命令时,我得到了这个错误列表
【发布时间】:2023-02-09 00:46:28
【问题描述】:
$ npm start
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR!     npm star # Mark your favorite packages
npm ERR!     npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\DELL\AppData\Local\npm-cache\_logs\2023-02-08T16_03_46_369Z-debug-0.log

是什么原因造成的?请注意这是我第一次在这台机器上运行这个命令。 我尝试在点击 npm start 之前运行 npm install,它说该应用程序是最新的,但有 231 个软件包正在寻找资金。不明白那是什么意思。如果有人在修复时向我解释原因,我将不胜感激。

谢谢。

【问题讨论】:

  • 你能在你的 package.json 中添加脚本部分吗?
  • 这回答了你的问题了吗? Start script missing error when running npm start
  • @terpinmd 好的,package.json 文件中没有脚本部分。我认为默认情况下应该在那里?我运行 npx create-react-app react-app 命令来像其他人一样创建项目,我的节点和 npm 是最新的。

标签: node.js reactjs npm npm-start


【解决方案1】:

此错误消息表明您正在尝试在项目中运行“npm start”脚本,但它未在 package.json 文件的项目“脚本”部分中定义。 你应该有一个这样的脚本:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-30
    • 2021-11-24
    • 2022-10-08
    • 2016-11-30
    • 2020-12-11
    • 2021-04-13
    • 1970-01-01
    相关资源
    最近更新 更多