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

Error while compiling versions 0.8.0 and above on Windows #267

Closed
ltomov opened this issue Feb 7, 2019 · 5 comments · Fixed by #313
Closed

Error while compiling versions 0.8.0 and above on Windows #267

ltomov opened this issue Feb 7, 2019 · 5 comments · Fixed by #313
Assignees
Milestone

Comments

@ltomov
Copy link

ltomov commented Feb 7, 2019

Environment details

Windows 10, nodejs version 8.9.3

  • OS: Windows
  • OS version: 10
  • node-pty version: 0.8.0 and above

Issue description

npm install fails on Windows with a number of C++ errors. I had to downgrade to version 0.7.8 to make it work. Below is the output of npm install:

$ npm install

node-pty@0.8.1 install node_modules\node-pty
node scripts/install.js


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.
  conpty.cc
  path_util.cc
  win_delay_load_hook.cc
node_modules\node-pty\src\win\conpty.cc(310): error C2065: 'STARTUPINFOEXW': undeclared identifier [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(310): error C2146: syntax error: missing ';' before identifier 'siEx' [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(310): error C2065: 'siEx': undeclared identifier [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(311): error C2065: 'siEx': undeclared identifier [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(311): error C2065: 'STARTUPINFOEXW': undeclared identifier [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(313): error C3861: 'InitializeProcThreadAttributeList': identifier not found [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(315): error C2065: 'siEx': undeclared identifier [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(317): error C2065: 'siEx': undeclared identifier [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(317): error C3861: 'InitializeProcThreadAttributeList': identifier not found [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(321): error C2065: 'siEx': undeclared identifier [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(323): error C3861: 'ProcThreadAttributeValue': identifier not found [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(321): error C3861: 'UpdateProcThreadAttribute': identifier not found [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(342): error C2065: 'siEx': undeclared identifier [node_modules\node-pty\build\conpty.vcxproj]
node_modules\node-pty\src\win\conpty.cc(333): error C2660: 'CreateProcessW': function does not take 9 arguments [node_modules\node-pty\build\conpty.vcxproj]
  c:\program files (x86)\windows kits\10\include\10.0.17134.0\um\processthreadsapi.h(389): note: see declaration of 'CreateProcessW' (compiling source file ..\src\win\conpty.cc)
  conpty_console_list.cc
  win_delay_load_hook.cc
     Creating library node_modules\node-pty\build\Release\conpty_console_list.lib and object node_modules\node-pty\build\Release\conpty_console_list.exp
  Generating code
  Finished generating code
  conpty_console_list.vcxproj -> node_modules\node-pty\build\Release\\conpty_console_list.node
  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 node_modules\node-pty\build\Release\winpty.lib and object node_modules\node-pty\build\Release\winpty.exp
  Generating code
  Finished generating code
  winpty.vcxproj -> node_modules\node-pty\build\Release\\winpty.dll
  Agent.cc
  AgentCreateDesktop.cc
  ConsoleFont.cc
  ConsoleInput.cc
  ConsoleInputReencoding.cc
  ConsoleLine.cc
  DebugShowInput.cc
  DefaultInputMap.cc
  EventLoop.cc
node_modules\node-pty\deps\winpty\src\agent\defaultinputmap.cc(291): warning C4244: 'argument': conversion from '__int64' to 'int', possible loss of data [node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
node_modules\node-pty\deps\winpty\src\agent\consoleinput.cc(121): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
node_modules\node-pty\deps\winpty\src\agent\consoleinput.cc(137): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
node_modules\node-pty\deps\winpty\src\agent\consoleinput.cc(155): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
node_modules\node-pty\deps\winpty\src\agent\consoleinput.cc(172): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
  InputMap.cc
  LargeConsoleRead.cc
  NamedPipe.cc
  Scraper.cc
  Terminal.cc
  Win32Console.cc
  Win32ConsoleBuffer.cc
  main.cc
node_modules\node-pty\deps\winpty\src\agent\scraper.cc(560): warning C4244: 'argument': conversion from 'int64_t' to 'const _Ty', possible loss of data [node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
          with
          [
              _Ty=int
          ]
node_modules\node-pty\deps\winpty\src\agent\scraper.cc(623): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
  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
  Generating code
node_modules\node-pty\deps\winpty\src\agent\agent.cc(231): warning C4722: 'Agent::~Agent': destructor never returns, potential memory leak [node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj]
  Finished generating code
  winpty-agent.vcxproj -> node_modules\node-pty\build\Release\\winpty-agent.exe
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd node_modules\node-pty
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs-xattr@0.1.17 (node_modules\fs-xattr):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fs-xattr@0.1.17: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: appdmg@0.5.2 (node_modules\appdmg):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for appdmg@0.5.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: macos-alias@0.2.11 (node_modules\macos-alias):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for macos-alias@0.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-pty@0.8.1 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-pty@0.8.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


@Tyriar
Copy link
Member

Tyriar commented Mar 1, 2019

I can't repro this, everything builds fine for me with this environment Windows 10 (18841) and node 10.15.1. It might be related to the Windows version 🤔

@oznu
Copy link

oznu commented Apr 8, 2019

This is just happening on node 8.x or lower. Builds against v10 and v11 work fine.

@Tyriar Tyriar added this to the 0.8.1 milestone Apr 12, 2019
@Tyriar Tyriar self-assigned this Apr 12, 2019
@Tyriar Tyriar closed this as completed in 3f5151d Apr 12, 2019
@Tyriar Tyriar modified the milestones: 0.8.1, 0.8.2 May 2, 2019
@ZoeyR
Copy link
Contributor

ZoeyR commented May 24, 2019

Is there a workaround for getting this to compile on node 8? I'm currently stuck on that version as its what visual studio ships.

@Tyriar
Copy link
Member

Tyriar commented May 24, 2019

@dgriffen you'd probably have to just stick on the older version or fork it into another branch and keep up that way if you wanted to update.

@ZoeyR
Copy link
Contributor

ZoeyR commented May 25, 2019

For anyone who arrives at this same issue: The problem is that the header files in the node sources define _WIN32_WINNT to be 0x502 when targeting node 8. In order for this to compile that needs to be set to 0x600 which it is in the node 10 sources. If you can somehow define this yourself then you will avoid the issue.

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

Successfully merging a pull request may close this issue.

4 participants