简体   繁体   中英

execFile Node.js - Shell script not found

I'm trying to autodeploy my project using node.js and Github webhooks. I followed this tutorial , but I'm getting this execFile function error:

{ [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }

I checked the shell script (hook.sh) file location and the fs.exists function says it's ok. I tried to exec other file than a shell script and it worked (or at least it found that file). So it might be some kind of problem with the bin/bash. I really don't know. The shell script file is located in the same directory as the hook.js file (see the tutorial).

My webhost is WebFaction.

My suggestion is to go over following steps

  1. Check the execution permission of hook.sh script by ls -l . You can try to set temporarily the permission for execution to all with sudo chmod a+x <PATH TO MY HOOK.SH>
  2. Be sure that here you are using the execFile('/path/to/hook.sh', execOptions, function(error, stdout, stderr) absolute path to the hook.sh script. If its not working try to point it to some dummy script which for example touches some file on file system.
  3. If none of above mentioned points helps. Turn the debugging mode of bash by running following command set -x . And check if the shell starts the execution of hook.sh at all

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM