【问题标题】:npm ERR! missing script: deploynpm 错误!缺少脚本:部署
【发布时间】:2020-02-05 16:54:02
【问题描述】:

我正在将我的应用程序部署到 github 页面,但是当我运行命令 npm run deploy 时出现错误

npm ERR! missing script: deploy

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\whoami\AppData\Roaming\npm-cache\_logs\2020-02-05T16_46_06_946Z-debug.log

我在 package.json 文件中定义了部署

...
"scripts": {
    "test": "jest --watchAll --verbose --coverage --runInBand",
    "start": "node index.js",
    "predeploy":"npm run build",
    "deploy":"gh-pages -d build"
  }
...

【问题讨论】:

  • 您确定在正确的目录中运行该命令吗?
  • 哦,是的,这是个问题,谢谢:d

标签: node.js reactjs npm github-pages package.json


【解决方案1】:

确保您已保存 package.json 文件。就我而言,我没有保存它,所以这就是错误来的原因

【讨论】:

    【解决方案2】:

    请关闭当前工作终端并打开新终端并再次尝试该命令。

    【讨论】:

      猜你喜欢
      • 2017-10-16
      • 1970-01-01
      • 1970-01-01
      • 2021-04-26
      • 2018-12-22
      • 2019-02-09
      • 2018-05-24
      • 1970-01-01
      • 2018-09-03
      相关资源
      最近更新 更多