在CF中调试Node.js应用 [英] Debug nodejs app in CF
问题描述
我遵循本指南,如何在CF中调试node.js应用程序及其当前不起作用,
I follow this guide how to debug node.js application in CF and its currently not working ,
我已经安装了节点检查器,并且在日志中看到如下消息:
I've installed the node inspector and I see message in the logs like:
2017-03-23T15:29:21.58+0200 [APP/PROC/WEB/0]ERR Debugger listening on [::]:5858
我执行了ssh命令
现在我该怎么办怎么办?指南中的
在ssh之后表示以下内容
Now what should I do ? in the guide it says the following after the ssh
-
export PATH = $ PATH:/ app /.heroku/node/bin
export PATH=$PATH:/app/.heroku/node/bin
.heroku应该是什么?我没有在heroku中运行...
那么我应该如何提供路径?
what should be .heroku ? I'm not running in heroku ... So how which path I should provide ?
2。当我运行在 /app/node_modules/.bin
./node-inspector --web-port=9090
**我收到错误消息:**
/ usr / bin / env:节点:没有这样的文件或目录
有什么想法吗?我想这与第一个问题有关。
**I got error: ** /usr/bin/env: node: No such file or directory any idea ? I guess it's related to the first issue...
我们正在开发CF版本2.74
We are working on CF version 2.74
推荐答案
从文档中...
如果您希望交互式SSH会话的环境与环境匹配具有相同环境变量和工作目录的基于buildpack的应用程序,在启动会话后运行以下命令:
If you want the environment of your interactive SSH session to match the environment of your buildpack-based app, with the same environment variables and working directory, run the following commands after starting the session:
export HOME=/home/vcap/app
export TMPDIR=/home/vcap/tmp
cd /home/vcap/app
[ -d /home/vcap/app/.profile.d ] && for f in /home/vcap/app/.profile.d/*.sh; do source "$f"; done
source /home/vcap/app/.profile
> https://docs.cloudfoundry.org/devguide/deploy-apps/ssh- apps.html#ssh-env
这些说明是通用的,对于Node.js构建包,您只需运行 HOME = / home / vcap / app源$ HOME / app / .profile.d / nodejs.sh
,因为从构建包中仅可以获取一个文件。然后,如果您的应用程序有一个并且需要/想要包含它,则可以选择获取 .profile
。
These instructions are generic though, for the Node.js build pack you could simply run HOME=/home/vcap/app source $HOME/app/.profile.d/nodejs.sh
since there's only one file to source from the build pack. Then optionally source the .profile
, if your app has one and you need / want to include it.
也,就像文档中提到的那样,您应该浏览所有 .profile
和 .profile.d / *。sh
脚本在运行它们以确保没有意外副作用之前。
Also, as the docs mention you should take a look through all .profile
and .profile.d/*.sh
scripts before running them to make sure there are no unintended side effects.
更新:
一种更简单的方法是运行 cf ssh myapp -t -c / tmp / lifecycle / launcher / home / vcap / app bash
。这将打开一个bash外壳,并让生命周期启动器处理源&建立环境。
A slightly easier way to do this is to run cf ssh myapp -t -c "/tmp/lifecycle/launcher /home/vcap/app bash ''"
. This will open a bash shell and it lets the lifecycle launcher handle sourcing & setting up the environment.
这篇关于在CF中调试Node.js应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!