0

This the Error

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

This is my 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

Thanks

Adiii
  • 54,482
  • 7
  • 145
  • 148

1 Answers1

-2

You need to tell npm what to do by adding the script to your package.json file. See https://docs.npmjs.com/misc/scripts for documentation.

tangerini
  • 76
  • 3
  • You should provide instructions on how to do so. – Peter Reid Jun 12 '17 at 21:05
  • Added link to npm documentation for specifying script in package.json. – tangerini Jun 12 '17 at 21:18
  • 2
    Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. See [how to write a good answer](https://stackoverflow.com/help/how-to-answer) – Peter Reid Jun 12 '17 at 21:19