【问题标题】:AWS codedeploy throwing error missing script: stopAWS codedeploy 抛出错误缺少脚本:停止
【发布时间】:2017-06-13 05:17:45
【问题描述】:

这是错误

Error CodeScriptFailed
Script Namescripts/stop.sh
MessageScript at specified location: scripts/stop.sh run as user root failed with exit code 1
Log TailLifecycleEvent - ApplicationStop
Script - scripts/stop.sh
[stderr]npm ERR! Linux 3.10.42-52.145.amzn1.x86_64
[stderr]npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "stop"
[stderr]npm ERR! node v4.8.3
[stderr]npm ERR! npm  v2.15.11
[stderr]
[stderr]npm ERR! missing script: stop
[stderr]npm ERR! 
[stderr]npm ERR! If you need help, you may report this error at:
[stderr]npm ERR!     <https://github.com/npm/npm/issues>
[stderr]
[stderr]npm ERR! Please include the following file with any support request:
[stderr]npm ERR!     /var/nodejs/CodeDeployDemo/npm-debug.log

这是我的 appspec.yml

version 0.0
os: linux
files:
  - source: /
    destination: /var/nodejs/CodeDeployDemo/

hooks:
  BeforeInstall:
    - location: scripts/install.sh
      timeout: 300
      runas: root
  AfterInstall:
    - location: scripts/post_install.sh
      timeout: 600
      runas: root
  ApplicationStart:
    - location: scripts/run.sh
      timeout: 120
      runas: root
  ApplicationStop:
    - location: scripts/stop.sh
      timeout: 120
      runas: root
  ValidateService:
    - location: scripts/validate.sh
      timeout: 60
      runas: root

stop.sh

#!/usr/bin/env
set -e
npm stop /var/nodejs/CodeDeployDemo/index.js

谢谢

【问题讨论】:

    标签: node.js amazon-web-services aws-code-deploy


    【解决方案1】:

    您需要通过将脚本添加到您的 package.json 文件中来告诉 npm 要做什么。有关文档,请参阅 https://docs.npmjs.com/misc/scripts

    【讨论】:

    • 您应该提供有关如何执行此操作的说明。
    • 添加了指向 npm 文档的链接,用于在 package.json 中指定脚本。
    • 鼓励链接到外部资源,但请在链接周围添加上下文,以便您的其他用户了解它是什么以及为什么存在。始终引用重要链接中最相关的部分,以防目标站点无法访问或永久离线。见how to write a good answer
    猜你喜欢
    • 2017-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-10
    相关资源
    最近更新 更多