首页 > 解决方案 > 错误:纱线启动 - 错误命令“start”未找到

问题描述

我正在尝试学习 React,并且我正在使用私人回购开始。

yarn start在 repo 的目录中运行,但收到​​错误消息:

yarn run v1.13.0
error Command "start" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

我同时安装了节点和纱线。

对于节点:

v10.15.0
node is /usr/local/bin/node

对于纱线:

1.13.0
yarn is /usr/local/bin/yarn

我尝试重新安装节点和纱线,但我收到相同的错误消息。此外,我试图通过删除纱线机会,yarn cache clean但似乎没有任何效果。

package.json包含以下内容:

{
  "name": "02-Manipulating-Strings",
  "version": "1.0.0",
  "author": "ssaunier",
  "license": "UNLICENSED",
  "private": true,
  "devDependencies": {
    "eslint": "^4.7.2",
    "eslint-config-airbnb-base": "^12.0.0",
    "eslint-plugin-import": "^2.7.0",
    "jest": "^21.1.0"
  },
  "scripts": {
    "test": "(eslint lib || true) && jest"
  }
}

该目录按以下方式组织:

项目目录

标签: reactjsnpmyarnpkg

解决方案


start该文件的脚本中没有命令package.json

"scripts": {
  "start": "some command to be run", // you need to add this line
  "test": "(eslint lib || true) && jest"
}

也许您想改为运行test命令 - npm test/ yarn test


推荐阅读