[英]Running debug node_module on Openshift
I recently started using Openshift and it's been great so far. 我最近开始使用Openshift,到目前为止效果非常好。 My current problem lies on the fact that my debug logs are not showing in Openshift's logs. 我当前的问题在于我的调试日志未显示在Openshift的日志中。 I used to run the app locally with DEBUG=*,-express:* node ./bin/www
and it showed everything I needed. 我以前使用DEBUG=*,-express:* node ./bin/www
在本地运行该应用程序,它显示了我所需的一切。 So far I haven't figured how to translate this into the package.json
file so that it works as intended. 到目前为止,我还没有弄清楚如何将其转换为package.json
文件,以使其按预期工作。
package.json
{
"name": "APP",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "DEBUG=*,-express:* node ./bin/www"
},
"main": "./bin/www",
"dependencies": { ... }
It seems to me that it is running the node
command with the main
data, instead of my much preferred script. 在我看来,它正在使用main
数据运行node
命令,而不是我更喜欢的脚本。 I believe that the debug module is a great alternative to spamming console.log()
on my code. 我相信调试模块是在我的代码中向console.log()
发送垃圾邮件的绝佳选择。
On the OpenShift log files it shows the following when starting the app. 启动应用程序时,在OpenShift日志文件上显示以下内容。 It is my understanding I am looking to find the --exec and change. 据我了解,我正在寻找--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'
If you look at the docs here and search for "markers", you'll find this: 如果您在此处查看文档并搜索“标记”,则会发现:
use_npm: use_npm:
Initialize your application or service using npm start instead of supervisor servername.js (where servername.js is based on the value of your package.json's main attribute). 使用npm start而不是超级用户 servername.js (其中servername.js基于package.json的main属性的值)来初始化应用程序或服务。
I still think that it is better for you to use supervisor. 我仍然认为使用主管更好。 But you can modify the value of debug within the code by having 但是您可以通过以下方式在代码中修改debug的值:
process.env.DEBUG='*,-express:*';
before the first use of require("debug"), at least as a temporary solution. 在第一次使用require(“ debug”)之前,至少作为临时解决方案。
HTH 高温超导
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.