【问题标题】:yarn start - command "start" not found纱线开始 - 找不到命令“开始”
【发布时间】:2020-10-16 22:48:54
【问题描述】:

yarn start 导致错误提示找不到命令“start”。在我的 package.json 文件中没有脚本的标签,这可能是问题所在。请提出修复建议。

我正在尝试安装 react,命令是:

npm install -g create-react-app@1.5.2
create-react-app confusion
yarn start

cmd 错误: command prompt

package.json:

 "名称": "混乱",
  “版本”:“0.1.0”,
  “私人”:真的,
  “依赖”:{
    “反应”:“^16.13.1”,
    “反应域”:“^16.13.1”,
    “反应脚本”:“3.4.1”
  }
}

【问题讨论】:

  • 尝试先运行yarn,然后再启动yarn。
  • 我试过这样做,但没有奏效。
  • 我认为这与纱线安装本身有关。你用的是linux吗?如果是这样,请尝试使用“sudo”安装全局包并复制我上面的建议。
  • 不,我使用的是 windows

标签: json reactjs npm yarnpkg


【解决方案1】:
  1. npm uninstall -g create-react-app // 卸载旧的 create-react-app 版本(在您的情况下为 v1.5.2)以确保 npx 在步骤 2 中使用最新版本
  2. npx create-react-app my-react-app-name // npx 安装最新版本的 create-react-app 不需要全局安装。它包含在 npm 中,因此无需安装。如果您愿意,请将 my-react-app-name 替换为您想要的项目名称
  3. cd my-react-app-name
  4. yarn start

【讨论】:

    猜你喜欢
    • 2018-03-02
    • 1970-01-01
    • 2022-01-14
    • 2019-10-09
    • 1970-01-01
    • 1970-01-01
    • 2022-01-19
    • 1970-01-01
    • 2014-06-07
    相关资源
    最近更新 更多