使用yarn构建node.js应用程序但出现错误命令“build”未找到

Aru*_*tel 6 node.js

这是我的 package.json 文件。

{
  "name": "moneymall",
  "version": "1.0.0",
  "description": "A money mall server app.",
  "main": "index.js",
  "author": "Anbu Selvan",
  "license": "ISC",
  "keywords": [],
  "dependencies": {
    "body-parser": "^1.18.3",
    "cors": "^2.8.5",
    "e": "0.0.4",
    "express": "^4.16.4",
    "mysql": "^2.16.0",
    "pug": "^2.0.3",
    "yarn": "^1.15.2"
  },
  "devDependencies": {
    "nodemon": "^1.18.10",
    "react-scripts": "^2.1.8"
  }
}
Run Code Online (Sandbox Code Playgroud)

运行yarn build并出现此错误。

纱线运行 v1.15.2 错误 找不到命令“build”。信息 请访问 https://yarnpkg.com/en/docs/cli/run以获取有关此命令的文档

Bin*_*ati 5

script.build您的文件中似乎没有定义密钥package.json。使用库进行构建的示例条目webpack为:

"scripts": {
    "build": "webpack"
  }
Run Code Online (Sandbox Code Playgroud)


Rob*_*ell 1

请重新阅读纱线文档。您似乎没有脚本键来声明您构建的脚本是什么,因此 Yarn 不知道要加载什么。