Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy failed spawn sh ENOENT #3839

Closed
newcomein opened this issue Aug 2, 2018 · 14 comments
Closed

Deploy failed spawn sh ENOENT #3839

newcomein opened this issue Aug 2, 2018 · 14 comments

Comments

@newcomein
Copy link

newcomein commented Aug 2, 2018

What's going wrong?

"D:\Program Files\JetBrains\WebStorm 2018.2\bin\runnerw.exe" "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run deploy_setup --scripts-prepend-node-path=auto

> coreProject@1.0.0 deploy_setup E:\WebstormProjects\coreProject
> pm2 deploy pm2.config.json production setup

--> Deploying to production environment
--> on host 185.***.***.***
Deploy failed
spawn sh ENOENT
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! coreProject@1.0.0 deploy_setup: `pm2 deploy pm2.config.json production setup`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the coreProject@1.0.0 deploy_setup 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!     C:\Users\admin\AppData\Roaming\npm-cache\_logs\2018-08-02T04_18_36_332Z-debug.log

Process finished with exit code 1

How could we reproduce this issue?

pm2 deploy pm2.config.json production setup

Supporting information

{
  "apps": [
    {
      "name": "coreProject",
      "script": "./dist/main.js",
      "watch": "./dist",
      "ignore_watch": [
        "./node_modules",
        ".src"
      ],
      "max_memory_restart": "800M",
      "instances": "max",
      "exec_mode": "cluster",
      "force": false,
      "append_env_to_name": true,
      "env": {
        "NODE_ENV": "development"
      },
      "env_production": {
        "NODE_ENV": "production"
      }
    }
  ],
  "deploy": {
    "production": {
      "user": "root",
      "host": "185.***.***.***",
      "ref": "origin/master",
      "repo": "root@git.***.com:***/coreProject.git",
      "path": "/www/wwwroot/coreProject",
      "post-deploy": "npm install",
      "ssh_options": "StrictHostKeyChecking=no"
    }
  }
}
$ pm2 report


[2018-08-02T12:16:49.906Z] PM2 log: ===============================================================================
[2018-08-02T12:16:49.916Z] PM2 log: --- New PM2 Daemon started ----------------------------------------------------
[2018-08-02T12:16:49.917Z] PM2 log: Time                 : Thu Aug 02 2018 12:16:49 GMT+0800 (GMT+08:00)
[2018-08-02T12:16:49.917Z] PM2 log: PM2 version          : 3.0.3
[2018-08-02T12:16:49.918Z] PM2 log: Node.js version      : 10.8.0
[2018-08-02T12:16:49.918Z] PM2 log: Current arch         : x64
[2018-08-02T12:16:49.918Z] PM2 log: PM2 home             : C:\Users\admin\.pm2
[2018-08-02T12:16:49.918Z] PM2 log: PM2 PID file         : C:\Users\admin\.pm2\pm2.pid
[2018-08-02T12:16:49.918Z] PM2 log: RPC socket file      : \\.\pipe\rpc.sock
[2018-08-02T12:16:49.919Z] PM2 log: BUS socket file      : \\.\pipe\pub.sock
[2018-08-02T12:16:49.919Z] PM2 log: Application log path : C:\Users\admin\.pm2\logs
[2018-08-02T12:16:49.919Z] PM2 log: Process dump file    : C:\Users\admin\.pm2\dump.pm2
[2018-08-02T12:16:49.919Z] PM2 log: Concurrent actions   : 2
[2018-08-02T12:16:49.919Z] PM2 log: SIGTERM timeout      : 1600
[2018-08-02T12:16:49.920Z] PM2 log: =============================================================================


$ npm report


0 info it worked if it ends with ok
1 verbose cli [ 'D:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'deploy_setup',
1 verbose cli   '--scripts-prepend-node-path=auto' ]
2 info using npm@6.2.0
3 info using node@v10.8.0
4 verbose run-script [ 'predeploy_setup', 'deploy_setup', 'postdeploy_setup' ]
5 info lifecycle coreProject@1.0.0~predeploy_setup: coreProject@1.0.0
6 info lifecycle coreProject@1.0.0~deploy_setup: coreProject@1.0.0
7 verbose lifecycle coreProject@1.0.0~deploy_setup: unsafe-perm in lifecycle true
8 verbose lifecycle coreProject@1.0.0~deploy_setup: PATH: D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\WebstormProjects\coreProject\node_modules\.bin;D:\Python27\;D:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;D:\Program Files\Git\cmd;D:\Program Files\Java\jdk\bin;D:\Go\bin;D:\Program Files (x86)\Yarn\bin\;D:\Program Files\nodejs\;D:\Program Files\Microsoft VS Code\bin;D:\Program Files\Process Lasso\;C:\Users\admin\AppData\Local\Microsoft\WindowsApps;D:\Program Files\Bandizip\;%GOPATH%\bin;D:\Program Files\Microsoft VS Code\bin;C:\Users\admin\AppData\Local\Yarn\bin;C:\Users\admin\AppData\Roaming\npm
9 verbose lifecycle coreProject@1.0.0~deploy_setup: CWD: E:\WebstormProjects\coreProject
10 silly lifecycle coreProject@1.0.0~deploy_setup: Args: [ '/d /s /c', 'pm2 deploy pm2.config.json production setup' ]
11 silly lifecycle coreProject@1.0.0~deploy_setup: Returned: code: 1  signal: null
12 info lifecycle coreProject@1.0.0~deploy_setup: Failed to exec deploy_setup script
13 verbose stack Error: coreProject@1.0.0 deploy_setup: `pm2 deploy pm2.config.json production setup`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:249:5)
14 verbose pkgid coreProject@1.0.0
15 verbose cwd E:\WebstormProjects\coreProject
16 verbose Windows_NT 10.0.17134
17 verbose argv "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "deploy_setup" "--scripts-prepend-node-path=auto"
18 verbose node v10.8.0
19 verbose npm  v6.2.0
20 error code ELIFECYCLE
21 error errno 1
22 error coreProject@1.0.0 deploy_setup: `pm2 deploy pm2.config.json production setup`
22 error Exit status 1
23 error Failed at the coreProject@1.0.0 deploy_setup script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
@wallet77
Copy link
Contributor

wallet77 commented Aug 2, 2018

Hi @newcomein

Is the path correct : "path": "/www/wwwroot/coreProject"
It should be "path": "/www/root/coreProject", no ?

@newcomein
Copy link
Author

@wallet77 Try it next time, and use webhook

@newcomein
Copy link
Author

@wallet77 But I operated under the condition of broken network, that is, the Deploy request was not issued.

@wallet77
Copy link
Contributor

wallet77 commented Aug 2, 2018

@newcomein spawn sh ENOENT with pm2-deploy can occurred if configuration is wrong.

@newcomein
Copy link
Author

@wallet77 Only these are the configuration items for Deploy

@zsodur
Copy link

zsodur commented Nov 4, 2018

Have you fixed this problem?

@newcomein
Copy link
Author

@zsodur no

@wopelo
Copy link

wopelo commented Nov 13, 2018

In windows, try to use git bash, using vscode shell or powershell will get this error

@vipinjn24
Copy link

On windows there is no 'sh' executable that is why this is giving error.
To resolve this issue include 'C:\Program Files\Git\bin' to the path variable as only this folder has sh.exe present.
after adding restart any code GUIs with integrated terminal like VS Code. and tada your issue is resolved.

@WhiteR4bbitt
Copy link

On windows there is no 'sh' executable that is why this is giving error.
To resolve this issue include 'C:\Program Files\Git\bin' to the path variable as only this folder has sh.exe present.
after adding restart any code GUIs with integrated terminal like VS Code. and tada your issue is resolved.

This! Thank you 👍

I didn't want to use git bash and I was about to use ubuntu from the windows store, but then I tried this and it worked in PowerShell!

@andreasanta
Copy link

Can you please invoke the correct executable on Windows?

@stale
Copy link

stale bot commented May 23, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 23, 2020
@stale stale bot closed this as completed Jun 6, 2020
@HNazmul-X
Copy link

I also found same error. I am using Windows oparating system.

@Cantarella
Copy link

On windows there is no 'sh' executable that is why this is giving error. To resolve this issue include 'C:\Program Files\Git\bin' to the path variable as only this folder has sh.exe present. after adding restart any code GUIs with integrated terminal like VS Code. and tada your issue is resolved.

Ваш совет решил мою проблему. Спасибо Вам!))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants