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:
我正在尝试使用node.js和Github webhooks自动部署我的项目。我按照本教程,但我得到这个execFile函数错误:
{ [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).
我检查了shell脚本(hook.sh)文件位置,fs.exists函数说没关系。我试图执行除shell脚本之外的其他文件并且它有效(或者至少它找到了该文件)。所以它可能是bin / bash的某种问题。我真的不知道。 shell脚本文件与hook.js文件位于同一目录中(请参阅教程)。
My webhost is WebFaction.
我的webhost是WebFaction。
1 个解决方案
#1
1
My suggestion is to go over following steps
我的建议是按照以下步骤进行
- Check the execution permission of
hook.sh
script byls -l
. You can try to set temporarily the permission for execution to all withsudo chmod a+x <PATH TO MY HOOK.SH>
- 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. - If none of above mentioned points helps. Turn the debugging mode of
bash
by running following commandset -x
. And check if the shell starts the execution ofhook.sh
at all
通过ls -l检查hook.sh脚本的执行权限。您可以尝试使用sudo chmod a + x
请确保在这里使用execFile('/ path / to / hook.sh',execOptions,function(error,stdout,stderr)绝对路径到hook.sh脚本。如果它不工作,请尝试将其指向某些虚拟脚本,例如触及文件系统上的某些文件。
如果上述要点都没有帮助。通过运行以下命令set -x来打开bash的调试模式。并检查shell是否开始执行hook.sh
#1
1
My suggestion is to go over following steps
我的建议是按照以下步骤进行
- Check the execution permission of
hook.sh
script byls -l
. You can try to set temporarily the permission for execution to all withsudo chmod a+x <PATH TO MY HOOK.SH>
- 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. - If none of above mentioned points helps. Turn the debugging mode of
bash
by running following commandset -x
. And check if the shell starts the execution ofhook.sh
at all
通过ls -l检查hook.sh脚本的执行权限。您可以尝试使用sudo chmod a + x
请确保在这里使用execFile('/ path / to / hook.sh',execOptions,function(error,stdout,stderr)绝对路径到hook.sh脚本。如果它不工作,请尝试将其指向某些虚拟脚本,例如触及文件系统上的某些文件。
如果上述要点都没有帮助。通过运行以下命令set -x来打开bash的调试模式。并检查shell是否开始执行hook.sh