在Openshift上运行debug node_module
问题描述:
我最近开始使用Openshift,到目前为止它一直很棒。我目前的问题在于我的调试日志没有显示在Openshift的日志中。我曾经使用DEBUG=*,-express:* node ./bin/www
在本地运行应用程序,它显示了我需要的一切。到目前为止,我还没有想到如何将其转换为package.json
文件,以便它按预期工作。在Openshift上运行debug node_module
package.json
{
"name": "APP",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "DEBUG=*,-express:* node ./bin/www"
},
"main": "./bin/www",
"dependencies": { ... }
在我看来,它正在运行与main
数据node
命令,而不是我的非常优选的脚本。我相信调试模块是我的代码上发送垃圾邮件console.log()
的好选择。
在OpenShift日志文件上,它启动应用程序时显示以下内容。这是我的理解,我期待找到--exec和改变。
DEBUG: Running node-supervisor with
DEBUG: program './bin/www'
DEBUG: --watch '/var/lib/openshift/<app_ID>/app-root/data/.nodewatch'
DEBUG: --ignore 'undefined'
DEBUG: --extensions 'node|js|coffee'
DEBUG: --exec 'node'
DEBUG: Starting child process with 'node ./bin/www'
答
如果你看一下文档here 并搜索 “标志”,你会发现这一点:
use_npm:
初始化使用NPM您的应用程序或服务启动 而不是主管servername.js(其中servername.js基于 对您的package.json的值主属性)。
我仍然认为你最好使用主管。但你可以通过在第一次使用require(“debug”)之前修改代码内的调试值,至少作为临时解决方案。
HTH