andrew / node-xbox-controller

:video_game: [UNMAINTAINED] Interface for Xbox 360 game controller into Node.js
http://libraries.io/npm/xbox-controller
MIT License
270 stars 49 forks source link

Added windows to supported OSes, targeting node-hid v0.3.1 #15

Closed ianwitherow closed 10 years ago

ianwitherow commented 10 years ago

Wanted to run this on Windows, so I updated to node-hid 0.3.1 and it seems to be working fine. I don't know if it doesn't work with node-hid 0.2.3; I just thought I'd try the latest version.

andrew commented 10 years ago

Excellent, thanks for testing this out, I don't have a windows machine and my rabbit chewed the wire on my controller at the moment!

EricSmekens commented 10 years ago

@ianwitherow , can you describe what you did to install it on Windows 8 x64? I'm trying to get it work at my machine, but I can't get it to work. (Not with npm install, not with node-gyp.) See: node-hid/node-hid#56

ianwitherow commented 10 years ago

@EricSmekens , I'm thinking it's gotta be something with your Visual Studio install. Maybe try downloading the trial version? I commented here with what I had to do from a fresh install of Windows 7 x64.

neocotic commented 10 years ago

I'm still seeing this issue and I'm not sure the original fix was correct.

According to npm os docs, they are matched against the value determined by node's process.platform which states that win32 is used for Windows platforms, not windows.

This would explain why I'm seeing the following confusing error:

159 error notsup Unsupported
159 error notsup Not compatible with your operating system or architecture: xbox-controller@0.4.1
159 error notsup Valid OS:    darwin,linux,windows
159 error notsup Valid Arch:  any
159 error notsup Actual OS:   win32
159 error notsup Actual Arch: x64
160 error System Windows_NT 6.2.9200
neocotic commented 10 years ago

I've raised #16 to address this.

I'm still having problems with node-hid not building on my Windows, but this at least lets me see those errors instead of blocking me saying windows is not supported.

ianwitherow commented 10 years ago

Strange, am I just installing differently? Here's what I did:

Here's the output I get: http://pastebin.com/np0AcjPs

neocotic commented 10 years ago

I'm getting failures because node-hid uses sh. What terminal are you using? I've tried using both Git Bash and Command Prompt.

andrew commented 10 years ago

@neocotic you might have more luck with http://www.cygwin.com/

ianwitherow commented 10 years ago

Just using the command prompt. Make sure you tick "Use Git and optional Unix tools from the Windows Command Prompt" when installing Git:

EricSmekens commented 10 years ago

That explains a lot. I will try this soon. This way we don't have to use node-gyp to install node-hid, I guess.

neocotic commented 10 years ago

@andrew I can't seem to get cygwin to work with either Node or NPM. Both get strange errors.

$ npm install
/cygdrive/c/Program Files/nodejs/npm: line 2: $'\r': command not found
/cygdrive/c/Program Files/nodejs/npm: line 4: $'\r': command not found
/cygdrive/c/Program Files/nodejs/npm: line 5: syntax error near unexpected token `$'in\r''
'cygdrive/c/Program Files/nodejs/npm: line 5: `case `uname` in
$ node

net.js:156
    this._handle.open(options.fd);
                 ^
Error: EINVAL, invalid argument
    at new Socket (net.js:156:18)
    at process.stdin (node.js:664:19)
    at startup (node.js:145:16)
    at node.js:906:3

@ianwitherow I've done that, and it makes no difference to me. I can use sh from command line and it will sadly still fail to build node-hid :( Here's what I'm seeing in the terminal:

  hid.c
..\hidapi\windows\hid.c(44): fatal error C1083: Cannot open include file: 'setu
papi.h': No such file or directory [c:\Users\Alasdair\Documents\GitHub\node-xbo
x-controller\node_modules\node-hid\build\hidapi.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (c:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:807:
12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "bui
ld" "install"
gyp ERR! cwd c:\Users\Alasdair\Documents\GitHub\node-xbox-controller\node_module
s\node-hid
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
npm ERR! node-hid@0.3.1 install: `sh install.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-hid@0.3.1 install script.
npm ERR! This is most likely a problem with the node-hid package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     sh install.sh
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-hid
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodej
s\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd c:\Users\Alasdair\Documents\GitHub\node-xbox-controller
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     c:\Users\Alasdair\Documents\GitHub\node-xbox-controller\npm-debug.l
og
npm ERR! not ok code 0
ianwitherow commented 10 years ago

@neocotic, I'm not sure what's going on. You have Python 2.7.6 and some fairly recent version of Visual Studio installed? I haven't tried with the express version, but I can try that later tonight.

andrew commented 10 years ago

Unfortunately I don't have a windows machine (or a working xbox box controller right now, :rabbit: chewed the cable) so I can't help debug much. Thanks for stepping up and helping out @ianwitherow

neocotic commented 10 years ago

I managed to get it working. I replaced VS2013 with VS2012 and then set the GYP_MSVS_VERSION environment variable to 2012. Thanks for all you help with this.

neocotic commented 10 years ago

It's working great by the way :) Please let me know when the new version is released so that I can try get a version bump on cylon-joystick, which uses this module.

andrew commented 10 years ago

@neocotic :shipit: https://github.com/andrew/node-xbox-controller/releases/tag/v0.4.2