rdepena / node-dualshock-controller

Eventing API layer over HID for the Sony DualShock 3 and DualShock 4 controllers
208 stars 46 forks source link

How do I run this code? #74

Open maurus56 opened 6 years ago

maurus56 commented 6 years ago

sorry about the stupid question but i tried with the "dualshock-controller" in the terminal thinking it was a standalone and also with "node dualshock-controller" and got this

maurolanzas-MBP:~ maurolanza$ node dualshock-controller
module.js:557
    throw err;
    ^

Error: Cannot find module '/Users/maurolanza/dualshock-controller'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:193:16)
    at bootstrap_node.js:617:3

and during instalation:

maurolanzas-MBP:~ maurolanza$ npm install dualshock-controller

> node-hid@0.5.7 install /Users/maurolanza/node_modules/node-hid
> prebuild-install || node-gyp rebuild

prebuild-install info begin Prebuild-install version 2.5.0
prebuild-install info looking for local prebuild @ prebuilds/node-hid-v0.5.7-node-v59-darwin-x64.tar.gz
prebuild-install info looking for cached prebuild @ /Users/maurolanza/.npm/_prebuilds/https-github.com-node-hid-node-hid-releases-download-v0.5.7-node-hid-v0.5.7-node-v59-darwin-x64.tar.gz
prebuild-install http request GET https://github.com/node-hid/node-hid/releases/download/v0.5.7/node-hid-v0.5.7-node-v59-darwin-x64.tar.gz
prebuild-install http 404 https://github.com/node-hid/node-hid/releases/download/v0.5.7/node-hid-v0.5.7-node-v59-darwin-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=9.4.0 runtime=node arch=x64 platform=darwin)
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

  CC(target) Release/obj.target/hidapi/hidapi/mac/hid.o
../hidapi/mac/hid.c:252:20: warning: comparison of integers of different signs: 'CFIndex' (aka 'long') and 'size_t' (aka 'unsigned long')
      [-Wsign-compare]
                if (chars_copied == len)
                    ~~~~~~~~~~~~ ^  ~~~
1 warning generated.
  LIBTOOL-STATIC Release/hidapi.a
  CXX(target) Release/obj.target/HID/src/HID.o
../src/HID.cc:207:45: warning: 'NewInstance' is deprecated [-Wdeprecated-declarations]
    Local<Object> buf = nodeBufConstructor->NewInstance(1, nodeBufferArgs);
                                            ^
/Users/maurolanza/.node-gyp/9.4.0/include/node/v8.h:3843:3: note: 'NewInstance' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/maurolanza/.node-gyp/9.4.0/include/node/v8config.h:321:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
1 warning generated.
  SOLINK_MODULE(target) Release/HID.node
npm WARN saveError ENOENT: no such file or directory, open '/Users/maurolanza/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/maurolanza/package.json'
npm WARN maurolanza No description
npm WARN maurolanza No repository field.
npm WARN maurolanza No README data
npm WARN maurolanza No license field.

+ dualshock-controller@1.1.1
added 56 packages in 84.514s

Is there any problem with that?

tobiasmuecksch commented 6 years ago

By looking at your error stack, I have to assume you are running this on Mac. Do you have Xcode installed?

idiotWu commented 6 years ago

Ran into same issue here with node.js v10.0.0 and Xcode 9.4.1 installed. Problem got solved when I switched to node.js v8.5.0 🤔.

itaisteinherz commented 5 years ago

What are you trying to do exactly? Running node dualshock-controller doesn't work because the command tells Node.js to run a file named dualshock-controller located in the current working directory, which in this case doesn't exist. To get started with some examples, check out the examples directory or ds-examples (if you're using a DualShock 4).