1

I am simply trying to use some bash to check some things then run the commands I want. But I'm getting stuck at the first hurdle:

hutber.sh

#!/bin/bash
echo 'hutber' ; exit 1;

package.json

"hutber": "./hutber.sh"

terminal

hutber@hutber-mint /var/www/mvt-framework $ npm run hutber

> [email protected] hutber /var/www/mvt-framework
> ./hutber.sh

hutber
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] hutber: `./hutber.sh`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] hutber script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/hutber/.npm/_logs/2017-12-05T15_52_44_355Z-debug.log

error log

0 info it worked if it ends with ok
1 verbose cli [ '/home/hutber/.nvm/versions/node/v8.7.0/bin/node',
1 verbose cli   '/home/hutber/.nvm/versions/node/v8.7.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'hutber' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prehutber', 'hutber', 'posthutber' ]
5 info lifecycle [email protected]~prehutber: [email protected]
6 info lifecycle [email protected]~hutber: [email protected]
7 verbose lifecycle [email protected]~hutber: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~hutber: PATH: /home/hutber/.nvm/versions/node/v8.7.0/lib/node_modules/npm/bin/node-gyp-bin:/var/www/mvt-framework/node_modules/.bin:/home/hutber/.nvm/versions/node/v8.7.0/bin:/home/hutber/bin:/home/hutber/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/hutber/Android/Sdk/tools:/home/hutber/Android/Sdk/platform-tools
9 verbose lifecycle [email protected]~hutber: CWD: /var/www/mvt-framework
10 silly lifecycle [email protected]~hutber: Args: [ '-c', './hutber.sh' ]
11 silly lifecycle [email protected]~hutber: Returned: code: 1  signal: null
12 info lifecycle [email protected]~hutber: Failed to exec hutber script
13 verbose stack Error: [email protected] hutber: `./hutber.sh`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/home/hutber/.nvm/versions/node/v8.7.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (/home/hutber/.nvm/versions/node/v8.7.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid [email protected]
15 verbose cwd /var/www/mvt-framework
16 verbose Linux 4.4.0-53-generic
17 verbose argv "/home/hutber/.nvm/versions/node/v8.7.0/bin/node" "/home/hutber/.nvm/versions/node/v8.7.0/bin/npm" "run" "hutber"
18 verbose node v8.7.0
19 verbose npm  v5.4.2
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] hutber: `./hutber.sh`
22 error Exit status 1
23 error Failed at the [email protected] hutber script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
6
  • How about posting /home/hutber/.npm/_logs/2017-12-05T15_52_44_355Z-debug.log? Commented Dec 5, 2017 at 15:58
  • Added, thanks for the suggestion Commented Dec 5, 2017 at 16:02
  • Can you post hutber.sh please Commented Dec 5, 2017 at 16:30
  • Its already there at the top of the question :) Commented Dec 5, 2017 at 16:37
  • Whoops! Sorry! I missed that..not sure what else to add. not much looking wrong to me.. Commented Dec 5, 2017 at 17:00

1 Answer 1

3

It works as expected.
You end your bash script with a code error 1, used for catching general errors, so npm throws an error.

error code ELIFECYCLE
error errno 1

It would end without error, if you change for a code 0:

#!/bin/bash
echo 'hutber' ; exit 0; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.