2017-12-05 21 views
0

私は単にいくつかの事をチェックしてから、私が望むコマンドを実行するためにいくつかのbashを使用しようとしています。しかし、私は最初のハードルで立ち往生しています:npm ERR! ELSEECYCLEでnpmのbashスクリプトを使用する場合

hutber.sh

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

package.json

"hutber": "./hutber.sh" 

ターミナル

[email protected] /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 

エラーログ

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 ] 
+0

方法/_logs/2017-12-05T15_52_44_355Z-debug.log? – ojf

+0

提案に感謝しました –

+0

hutber.shを投稿できますか – ojf

答えて

1

期待通りに動作します。
一般的なエラーの捕捉に使用されるコード・エラー1でbashスクリプトを終了します。したがって、npmはエラーをスローします。

エラーコードELIFECYCLE
エラーerrnoを1

あなたはコード0のために変更する場合は、エラーなしで終わるだろう:/home/hutber/.npmを掲示について

#!/bin/bash 
echo 'hutber' ; exit 0; 
関連する問題