gpt4 book ai didi

windows - iisnode:未知的标准输入文件类型

转载 作者:太空宇宙 更新时间:2023-11-04 01:05:40 25 4
gpt4 key购买 nike

我的iisnode在win8/IIS8上运行顺利。我创建了一个非常简单的 hello world 并且效果很好。但是,当我尝试使用 process.stdin 时,出现以下错误:

Application has thrown an uncaught exception and is terminated:
Error: Implement me. Unknown stdin file type!
at process.startup.processStdio.process.openStdin [as stdin] (node.js:405:17)
at Object.<anonymous> (C:\ApprendaPlatform\SiteData\developer\v1\root\shim\node_modules\actionhero\bin\zzz.js:7:20)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (C:\Program Files\iisnode\interceptor.js:210:1)
at Module._compile (module.js:449:26)

请注意,我没有通过 process.stdout 得到这个。

我的代码:

// kaboom!
var breakthings = process.stdin;

// works
// var breakthings = process.stdout;

iisnode 是否对标准输入做了一些奇怪的事情,或者我是否配置错误?

最佳答案

就我而言,由于问题仍然存在,我只是覆盖 iisnode 文件中 process.stdin 的 getter

var events = require('events');

// Define a custom getter for process.stdin since iisnode still didn't fix the bug
process.__defineGetter__('stdin', function(){
return new events.EventEmitter();
})

// no kaboom anymore ;)
var breakthings = process.stdin;

希望这有帮助;)

更新(2016 年 6 月 2 日):以更明智和干净的方式:

var events = require('events');

delete process.stdin;
process.stdin = new events.EventEmitter();

// no kaboom anymore ;)
var breakthings = process.stdin;

关于windows - iisnode:未知的标准输入文件类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23281098/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com