简体   繁体   English

设置一个Xcode机器人以构建和部署Node.js Express服务器

[英]Set up an xcode bot to build and deploy a nodejs express server

I am attempting to set up a xcode project and bot that will build a nodejs application on commit from a github repository and restart the server after the build completes. 我试图建立一个xcode项目和机器人,它将on commit github存储库中的on commit构建一个nodejs应用程序on commit并在构建完成后重新启动服务器。 The bot is currently picking up on the repository changes but fails to build correctly. 该机器人当前正在获取存储库更改,但无法正确构建。

I am using a xcode external build tool project that uses /bin/bash as the tool path and the working directory is set to the local repository path. 我正在使用一个xcode external build tool project ,该external build tool project使用/bin/bash作为工具路径,并且工作目录设置为本地存储库路径。

The bot's after integration script is something like, 机器人的after integration脚本如下所示:

npm install --production
npm run build
npm run server:restart

I am getting errors like [npm|node] is not recognized . 我收到类似[npm|node] is not recognized

Just looking for some clarity to what I might be missing or what could be going wrong. 只是想弄清楚我可能缺少的东西或可能出了问题的地方。

Add this to the beginning of your script and review the output: 将其添加到脚本的开头并查看输出:

which node
set | grep PATH

This will happen if node is not in your path, which may happen because build scripts have a pretty basic environment - they're not running as a normal user. 如果节点不在您的路径中,则会发生这种情况,这可能是因为构建脚本具有相当基本的环境-它们没有以普通用户身份运行。 You may need to add it to your PATH at the start of your build script. 您可能需要在构建脚本的开头将其添加到PATH中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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