【问题标题】:npm run build not working: `sh: 1: start: not found`npm run build 不工作:`sh: 1: start: not found`
【发布时间】:2021-09-07 00:08:06
【问题描述】:

无法构建 nodejs 项目 npm run build 不起作用,我也尝试过 nodemon 仍然无法做到。 应用程序在localhost:3000 中运行良好。 但在构建时它失败了

me@sf:~$ npm run build

> project@1.0.1 build
> start build

sh: 1: start: not found

package.json

    "scripts": {
        "test": "test",
        "start": "node index.js",
        "build": "start build"
    },

【问题讨论】:

  • 您是否试图从build 脚本中引用start 脚本?这不是它的工作原理——build 命令应该做什么?
  • 脚本中的start build 命令是什么?
  • @DaveNewton 它应该构建项目。我以前也这样做过。
  • 如何构建?什么? buildstart build 中的那个)从何而来?什么是startstart build 中的那个),它来自哪里?
  • 我不知道,只是在 azure 上部署失败。

标签: node.js express npm nodemon npm-build


【解决方案1】:

删除"build": "start build" 行解决了我的问题。

    "scripts": {
        "test": "test",
        "start": "node index.js"
    },

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-02-01
    • 2021-03-11
    • 1970-01-01
    • 2020-05-09
    • 2020-10-26
    • 2021-10-20
    • 2019-08-20
    • 1970-01-01
    相关资源
    最近更新 更多