简体   繁体   English

我如何在node.js中运行此脚本?

[英]How I can run this script in node.js?

I have install all modules need to run this script using CMD. 我已经安装了所有需要使用CMD运行此脚本的模块。 When I am run this script in node.js through webmatrix: 当我通过webmatrix在node.js中运行此脚本时:

var http = require('http');
var everyauth = require('everyauth');
var app = require('express').createServer();

app.get('/', function(request, response) {
    response.send('Hello Express!!');
});

app.listen(2455);

It's not working. 它不起作用。 The error is: 错误是:

iisnode encountered an error when processing the request.

HRESULT: 0x2
HTTP status: 500
HTTP reason: Internal Server Error
You are receiving this HTTP 200 response because system.webServer/iisnode/@devErrorsEnabled configuration setting is 'true'.

In addition to the log of stdout and stderr of the node.exe process, consider using debugging and ETW traces to further diagnose the problem.

The node.exe process has not written any information to the stdout or stderr.

I have tried with different different script from blog but they do not work. 我尝试过与博客不同的不同脚本,但它们不起作用。 I tried Steven Sanderson's template in webmatrix and that does work. 我在webmatrix中尝试了Steven Sanderson的模板,这确实有效。

To use your application with iisnode, you have to use port/socket supplied by iisnode (as in this case you're using IIS as a webserver instead of the one bundled in node). 要将您的应用程序与iisnode一起使用,您必须使用iisnode提供的端口/套接字(因为在这种情况下,您使用IIS作为Web服务器而不是节点中捆绑的那个)。

Replace the last line with app.listen(process.env.port || 2455); app.listen(process.env.port || 2455);替换最后一行app.listen(process.env.port || 2455); , so that it will both work well with iisnode and be available on port 2455 when run with node.exe app.js . ,以便它与iisnode一起运行良好,并在与node.exe app.js运行时在端口2455上可用。

Use 使用

app.listen(process.env.port || 2455); app.listen(process.env.port || 2455);

instead of ` 而不是`

app.listen(portno); app.listen(PORTNO);

cause it's iisnode web server. 因为它是iisnode网络服务器。

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

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