Reputation: 12161
I've been struggling with this errors for 2 days and can't realize why electron renderer process.stdin
fails in windows os.
How to reproduce:
type npm install devtool -g
then type devtool
inside the console type process.stdin
and there will be an error message will be two errors, one at line 127 and the other at line 128 at C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\node_modules\electron-prebuilt\dist\resources\atom.asar\renderer\lib\init.js(devtool update 2.x)
Error: Implement me. Unknown stdin file type!
C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\node_modules\electron-prebuilt\dist\resour…:127 Error: Implement me. Unknown stdin file type!(…)(anonymous function) @ C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\node_modules\electron-prebuilt\dist\resour…:127Module._compile @ module.js:425Module._extensions..js @ module.js:432Module.load @ module.js:356Module._load @ module.js:313Module.runMain @ module.js:457startup @ node.js:151(anonymous function) @ node.js:1007
C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\node_modules\electron-prebuilt\dist\resour…:128 Error: Implement me. Unknown stdin file type!
at process.stdin (node.js:747)
at hookProcess (C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\lib\preload.js:117)
at C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\lib\preload.js:29
at Object.<anonymous> (C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\lib\preload.js:129)
at Module._compile (module.js:425)
at Object.Module._extensions..js (module.js:432)
at Module.load (module.js:356)
at Function.Module._load (module.js:313)
at Module.require (module.js:366)
at require (module.js:385)(anonymous function) @ C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\node_modules\electron-prebuilt\dist\resour…:128Module._compile @ module.js:425Module._extensions..js @ module.js:432Module.load @ module.js:356Module._load @ module.js:313Module.runMain @ module.js:457startup @ node.js:151(anonymous function) @ node.js:1007
Upvotes: 11
Views: 1924
Reputation: 8605
A super simple workaround would be to just force devtool to run in its own console window.
So instead of running:
devtool
Run this:
start devtool
It should pop up in a new window and not be confused about the input pipe.
The same trick works with a lot of Node packages.
Upvotes: 1
Reputation: 26428
I've had this error when trying to start electron up from a console window; it was odd because it had been working fine. I have realised today that the only thing I changed was to launch a terminal window from Visual Studio Code (with add-on).
If I use a Terminal created from VS Code (terminal addon) then when I try to run node_modules\.bin\electron
I get:
d:\Code\Applications\Example>"node_modules\.bin\electron"
internal/process/stdio.js:86
throw new Error('Implement me. Unknown stdin file type!');
^
Error: Implement me. Unknown stdin file type!
at process.stdin (internal/process/stdio.js:86:15)
at startup (node.js:198:18)
at node.js:457:3
if I make a console window directly in Explorer, it works perfectly fine.
Upvotes: 0
Reputation: 10827
Reading through the libuv source code which is what nodejs uses for certain low-level operations, seems that the reason is that the type of buffer or handle cannot be determined specifically for windows. The GetFileType
function seems to return an unknown handle.
This is definitely a windows only issue because the part of the library that determines the type of handle is within src/win/handle.c
of the UV source code so I don't think this affects *NIX OS'es indeed.
Maybe the installed nodejs version is missing a build-time option?
Upvotes: 1
Reputation: 1103
There is another question pointing to the same problem. One of the comments states that it's a known iisnode
issue and also suggests a work around by wrapping all calls to process.stdin
like:
if(!process.env.IISNODE_VERSION) {
// do stuff with process.stdin
}
It can be a temporary solution. I'm sure you've already taken a look to that post, what do you think?
Upvotes: 1
Reputation: 8785
I encountered the same problem.
First I thought that devtool as REPL does not need stdin and was a simple bug in windows build. GitHub repo owners fix it just ignoring stdin on startup but, as you had discovered, devtool is broken and you can not do anything with stdin in windows.
As a proof of concept I create a simple example beyond devtool REPL:
This piece of code does not work.
//test.js
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: true
});
rl.on('line', function(line){
console.log(line);
})
devtool test.js < input.txt
Error: Implement me. Unknown stdin file type!
Windows 7 x64, S.O. Admin rights, Node v5.10.0, npm v3.8.3 DevTool v1.9.1.
I had left a comment in your github issue but is closed so I opened a new one.
Upvotes: 3