Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work on Windows (?) #109

Closed
stevenvachon opened this issue Jul 14, 2017 · 7 comments
Closed

Doesn't work on Windows (?) #109

stevenvachon opened this issue Jul 14, 2017 · 7 comments
Labels

Comments

@stevenvachon
Copy link

stevenvachon commented Jul 14, 2017

const {spawn} = require("node-pty");

const exe = spawn("node", ["child.js"], {});

exe.once("finish", (...args) => console.log("finish", args));
exe.once("error", (...args) => console.log("error", args));
exe.once("exit", (...args) => console.log("exit", args));
Error: File not found:
 at new WindowsPtyAgent (node_modules\node-pty\lib\windowsPtyAgent.js:25:24)
 at new WindowsTerminal (node_modules\node-pty\lib\windowsTerminal.js:45:23)
 at spawn (node_modules\node-pty\lib\index.js:27:12)
 at Context.<anonymous> (test.js:21:14)

It works on OSX and Linux.


#110

@Tyriar
Copy link
Member

Tyriar commented Jul 14, 2017

Are you sure the build was successful? You need the deps for https://github.com/rprichard/winpty installed (this isn't really documented). Check the output of the module install.

@stevenvachon
Copy link
Author

stevenvachon commented Jul 14, 2017

PS C:\Users\Steven\desktop\dotenv-prompt> npm install

> [email protected] install C:\project\node_modules\node-pty
> node scripts/install.js


C:\project\node_modules\node-pty>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  Agent.cc
  AgentCreateDesktop.cc
  ConsoleFont.cc
  ConsoleInput.cc
..\..\..\..\deps\winpty\src\agent\ConsoleInput.cc(121): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [C:\project\node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
..\..\..\..\deps\winpty\src\agent\ConsoleInput.cc(137): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [C:\project\node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
..\..\..\..\deps\winpty\src\agent\ConsoleInput.cc(155): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [C:\project\node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
..\..\..\..\deps\winpty\src\agent\ConsoleInput.cc(172): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [C:\project\node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
  ConsoleInputReencoding.cc
  ConsoleLine.cc
  DebugShowInput.cc
  DefaultInputMap.cc
..\..\..\..\deps\winpty\src\agent\DefaultInputMap.cc(291): warning C4244: 'argument': conversion from '__int64' to 'int', possible loss of data [C:\project\node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
  EventLoop.cc
  InputMap.cc
  LargeConsoleRead.cc
  NamedPipe.cc
  Scraper.cc
..\..\..\..\deps\winpty\src\agent\Scraper.cc(561): warning C4244: 'argument': conversion from 'int64_t' to 'const int', possible loss of data [C:\project\node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
..\..\..\..\deps\winpty\src\agent\Scraper.cc(623): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\project\node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
  Terminal.cc
  Win32Console.cc
  Win32ConsoleBuffer.cc
  main.cc
  BackgroundDesktop.cc
  Buffer.cc
  DebugClient.cc
  Compiling...
  GenRandom.cc
  OwnedHandle.cc
  StringUtil.cc
  WindowsSecurity.cc
  WindowsVersion.cc
  WinptyAssert.cc
  WinptyException.cc
  WinptyVersion.cc
  win_delay_load_hook.cc
  Generating code
c:\users\steven\desktop\dotenv-prompt\node_modules\node-pty\deps\winpty\src\agent\agent.cc(231): warning C4722: 'Agent::~Agent': destructor never returns, potential memory leak [C:\project\node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
  Finished generating code
  winpty-agent.vcxproj -> C:\project\node_modules\node-pty\build\Release\\winpty-agent.exe
  winpty-agent.vcxproj -> C:\project\node_modules\node-pty\build\Release\winpty-agent.pdb (F
  ull PDB)
  AgentLocation.cc
  winpty.cc
  BackgroundDesktop.cc
  Buffer.cc
  DebugClient.cc
  GenRandom.cc
  OwnedHandle.cc
  StringUtil.cc
  WindowsSecurity.cc
  WindowsVersion.cc
  WinptyAssert.cc
  WinptyException.cc
  WinptyVersion.cc
  win_delay_load_hook.cc
     Creating library C:\project\node_modules\node-pty\build\Release\winpty.lib and object C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\Release\winpty.exp
  Generating code
  Finished generating code
  winpty.vcxproj -> C:\project\node_modules\node-pty\build\Release\\winpty.dll
  winpty.vcxproj -> C:\project\node_modules\node-pty\build\Release\winpty.pdb (Full PDB)
  pty.cc
..\src\win\pty.cc(51): warning C4311: 'type cast': pointer truncation from 'HANDLE' to 'int' [C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\pty.vcxproj]
..\src\win\pty.cc(51): warning C4302: 'type cast': truncation from 'HANDLE' to 'int' [C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\pty.vcxproj]
..\src\win\pty.cc(62): warning C4311: 'type cast': pointer truncation from 'HANDLE' to 'int' [C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\pty.vcxproj]
..\src\win\pty.cc(62): warning C4302: 'type cast': truncation from 'HANDLE' to 'int' [C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\pty.vcxproj]
..\src\win\pty.cc(245): warning C4311: 'type cast': pointer truncation from 'HANDLE' to 'int' [C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\pty.vcxproj]
..\src\win\pty.cc(245): warning C4302: 'type cast': truncation from 'HANDLE' to 'int' [C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\pty.vcxproj]
..\src\win\pty.cc(246): warning C4311: 'type cast': pointer truncation from 'HANDLE' to 'int' [C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\pty.vcxproj]
..\src\win\pty.cc(246): warning C4302: 'type cast': truncation from 'HANDLE' to 'int' [C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\pty.vcxproj]
..\src\win\pty.cc(263): warning C4533: initialization of 'marshal' is skipped by 'goto cleanup' [C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\pty.vcxproj]
  ..\src\win\pty.cc(243): note: see declaration of 'marshal'
  ..\src\win\pty.cc(263): note: see declaration of 'cleanup'
..\src\win\pty.cc(314): warning C4312: 'type cast': conversion from 'int32_t' to 'HANDLE' of greater size [C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\pty.vcxproj]
  win_delay_load_hook.cc
     Creating library C:\project\node_modules\node-pty\build\Release\pty.lib and object C:\Users\Steven\desktop\dotenv-prompt\node_modules\node-pty\build\Release\pty.exp
  Generating code
  Finished generating code
  pty.vcxproj -> C:\project\node_modules\node-pty\build\Release\\pty.node
  pty.vcxproj -> C:\project\node_modules\node-pty\build\Release\pty.pdb (Full PDB)

> [email protected] postinstall C:\project\node_modules\node-pty
> node scripts/post-install.js

npm notice created a lockfile as package-lock.json. You should commit this file.
added 3 packages in 77.766s

@Tyriar
Copy link
Member

Tyriar commented Jul 14, 2017

Ah, you're actually hitting here: https://github.com/Tyriar/node-pty/blob/e9116e16f880d327c45235480c7adc881fe7125d/src/win/pty.cc#L187

This is because node cannot be found, you need to point at the actual executable on disk.

@Tyriar Tyriar closed this as completed Jul 14, 2017
@stevenvachon
Copy link
Author

Oh, I'll try that, then.

@Tyriar
Copy link
Member

Tyriar commented Jul 14, 2017

node.exe may also work.

@stevenvachon
Copy link
Author

node.exe worked! Thank you.

@Tyriar
Copy link
Member

Tyriar commented Jul 14, 2017

Great 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants