rdepena / node-dualshock-controller

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

Can't install via NPM #40

Open iamdriz opened 9 years ago

iamdriz commented 9 years ago

When doing: npm install dualshock-controller

I get the following error (copied from log file):

0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   'dualshock-controller' ]
2 info using npm@2.1.11
3 info using node@v0.10.33
4 verbose config Skipping project config: /Users/cameron/.npmrc. (matches userconfig)
5 silly cache add args [ 'dualshock-controller', null ]
6 verbose cache add spec dualshock-controller
7 silly cache add parsed spec { raw: 'dualshock-controller',
7 silly cache add   scope: null,
7 silly cache add   name: 'dualshock-controller',
7 silly cache add   rawSpec: '',
7 silly cache add   spec: '*',
7 silly cache add   type: 'range' }
8 verbose addNamed dualshock-controller@*
9 silly addNamed semver.valid null
10 silly addNamed semver.validRange *
11 silly addNameRange { name: 'dualshock-controller', range: '*', hasData: false }
12 silly mapToRegistry name dualshock-controller
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry https://registry.npmjs.org/
15 silly mapToRegistry uri https://registry.npmjs.org/dualshock-controller
16 verbose addNameRange registry:https://registry.npmjs.org/dualshock-controller not in flight; fetching
17 verbose request uri https://registry.npmjs.org/dualshock-controller
18 verbose request no auth needed
19 info attempt registry request try #1 at 01:01:52
20 verbose request id d2074a7f921a9041
21 verbose etag "28F282ZZS75UJHP4K5YVW5DX9"
22 http request GET https://registry.npmjs.org/dualshock-controller
23 http 304 https://registry.npmjs.org/dualshock-controller
24 silly get cb [ 304,
24 silly get   { date: 'Thu, 11 Dec 2014 01:01:53 GMT',
24 silly get     server: 'Apache',
24 silly get     via: '1.1 varnish',
24 silly get     'last-modified': 'Thu, 11 Dec 2014 01:01:53 GMT',
24 silly get     'cache-control': 'max-age=60',
24 silly get     etag: '"28F282ZZS75UJHP4K5YVW5DX9"',
24 silly get     age: '0',
24 silly get     'x-served-by': 'cache-lcy1129-LCY',
24 silly get     'x-cache': 'MISS',
24 silly get     'x-cache-hits': '0',
24 silly get     'x-timer': 'S1418259713.077236,VS0,VE630',
24 silly get     vary: 'Accept',
24 silly get     'content-length': '0',
24 silly get     'keep-alive': 'timeout=10, max=50',
24 silly get     connection: 'Keep-Alive' } ]
25 verbose etag https://registry.npmjs.org/dualshock-controller from cache
26 silly addNameRange number 2 { name: 'dualshock-controller', range: '*', hasData: true }
27 silly addNameRange versions [ 'dualshock-controller',
27 silly addNameRange   [ '0.0.1',
27 silly addNameRange     '0.0.2',
27 silly addNameRange     '0.0.3',
27 silly addNameRange     '0.1.0',
27 silly addNameRange     '0.2.0',
27 silly addNameRange     '0.2.1',
27 silly addNameRange     '0.2.2',
27 silly addNameRange     '0.3.0',
27 silly addNameRange     '0.3.1',
27 silly addNameRange     '0.4.0',
27 silly addNameRange     '0.4.1',
27 silly addNameRange     '0.4.2',
27 silly addNameRange     '0.5.0',
27 silly addNameRange     '0.5.1',
27 silly addNameRange     '0.6.0',
27 silly addNameRange     '0.6.1',
27 silly addNameRange     '0.6.2',
27 silly addNameRange     '0.6.3',
27 silly addNameRange     '0.6.4',
27 silly addNameRange     '0.6.5',
27 silly addNameRange     '0.6.6',
27 silly addNameRange     '0.6.7' ] ]
28 verbose addNamed dualshock-controller@0.6.7
29 silly addNamed semver.valid 0.6.7
30 silly addNamed semver.validRange 0.6.7
31 silly cache afterAdd dualshock-controller@0.6.7
32 verbose afterAdd /Users/cameron/.npm/dualshock-controller/0.6.7/package/package.json not in flight; writing
33 verbose afterAdd /Users/cameron/.npm/dualshock-controller/0.6.7/package/package.json written
34 silly install resolved [ { name: 'dualshock-controller',
34 silly install resolved     version: '0.6.7',
34 silly install resolved     description: 'node library for dual shock controllers',
34 silly install resolved     main: './lib/dualshock.js',
34 silly install resolved     directories: { example: 'examples', test: 'test' },
34 silly install resolved     dependencies:
34 silly install resolved      { 'node-hid': '^0.3',
34 silly install resolved        colors: '^0.6',
34 silly install resolved        joystick: '^0.1.1',
34 silly install resolved        lodash: '^2.4.1' },
34 silly install resolved     devDependencies:
34 silly install resolved      { grunt: '^0.4',
34 silly install resolved        'grunt-cli': '^0.1',
34 silly install resolved        'grunt-contrib-jshint': '^0.10',
34 silly install resolved        'grunt-contrib-watch': '^0.6',
34 silly install resolved        'grunt-mocha-test': '^0.10',
34 silly install resolved        mocha: '^1.17',
34 silly install resolved        sinon: '^1.8',
34 silly install resolved        istanbul: '^0.2',
34 silly install resolved        'grunt-jsbeautifier': '^0.2.7',
34 silly install resolved        jshint: '^2.5.0',
34 silly install resolved        mockery: '^1.4.0' },
34 silly install resolved     scripts: { test: 'grunt test', coverage: 'istanbul cover _mocha' },
34 silly install resolved     repository:
34 silly install resolved      { type: 'git',
34 silly install resolved        url: 'https://github.com/rdepena/node-dualshock-controller.git' },
34 silly install resolved     author: { name: 'ricardo de pena' },
34 silly install resolved     license: 'MIT',
34 silly install resolved     readmeFilename: 'README.md',
34 silly install resolved     gitHead: 'ec07ab438dd6cd129000b285f33d8be7c59342b6',
34 silly install resolved     keywords:
34 silly install resolved      [ 'ps3',
34 silly install resolved        'controller',
34 silly install resolved        'gamepad',
34 silly install resolved        'dualshock',
34 silly install resolved        'dualshock3',
34 silly install resolved        'dualshock4',
34 silly install resolved        'dual shock 3',
34 silly install resolved        'dual shock 4',
34 silly install resolved        'node-hid' ],
34 silly install resolved     readme: 'node-dualshock-controller\n=========================\n[![Build Status](https://travis-ci.org/rdepena/node-dualshock-controller.png?branch=master)](https://travis-ci.org/rdepena/node-dualshock-controller) [![Code Climate](https://codeclimate.com/github/rdepena/node-dualshock-controller.png)](https://codeclimate.com/github/rdepena/node-dualshock-controller)\n\n`dualshock-controller` is a node library that exposes events from a ps3 (ps4 partially supported) dualshock controller connected.\n\n## Installation:\n\n### Linux Requirements:\n\n    * libudev-dev\n\n### Run npm command:\n\n    $ npm install dualshock-controller\n\n\n\n## Guide\n\n###Connecting the controller\n\nObviously the controller needs to be connected but you can connect the dualshock controllers in two ways:\n\nVia Bluetooth: just make sure you pair with the controller via bluetooth.\n\nVia USB: once the controller is connected to the computer make sure you press the playstation button located in the center of the controller. Important: THE CONTROLLER WILL NOT SEND ANY DATA IF YOU DO NOT PRESS THE PS BUTTON.\n\n\n###Use the DualShock library\n\n~~~~ js\nvar dualShock = require(\'dualshock-controller\');\n\n//pass options to init the controller.\nvar controller = dualShock(\n    {\n        //you can use a ds4 by uncommenting this line.\n        //config: "dualshock4-generic-driver",\n        //if using ds4 comment this line.\n        config : "dualShock3",\n        //smooths the output from the acelerometers (moving averages) defaults to true\n        accelerometerSmoothing : true,\n        //smooths the output from the analog sticks (moving averages) defaults to false\n        analogStickSmoothing : false\n    });\n\n//make sure you add an error event handler\ncontroller.on(\'error\', function(data) {\n  //...someStuffDidNotWork();\n});\n\n//add event handlers:\ncontroller.on(\'left:move\', function(data) {\n  //...doStuff();\n});\ncontroller.on(\'right:move\', function(data) {\n  //...doStuff();\n});\ncontroller.on(\'connected\', function(data) {\n  //...doStuff();\n});\ncontroller.on(\'square:press\', function (data) {\n  //...doStuff();\n});\ncontroller.on(\'square:release\', function (data) {\n  //...doStuff();\n});\n\n//sixasis motion events:\n//the object returned from each of the movement events is as follows:\n//{\n//    direction : values can be: 1 for right, forward and up. 2 for left, backwards and down.\n//    value : values will be from 0 to 120 for directions right, forward and up and from 0 to -120 for left, backwards and down.\n//}\n\n//right-left movement\ncontroller.on(\'rightLeft:motion\', function (data) {\n    //...doStuff();\n});\n\n//forward-back movement\ncontroller.on(\'forwardBackward:motion\', function (data) {\n    //...doStuff();\n});\n//up-down movement\ncontroller.on(\'upDown:motion\', function (data) {\n    //...doStuff();\n});\n\n//controller status\n//as of version 0.6.2 you can get the battery %, if the controller is connected and if the controller is charging\ncontroller.on(\'battery:change\', function (value) {\n     //...doStuff();\n});\ncontroller.on(\'connection:change\', function (value) {\n     //...doStuff();\n});\ncontroller.on(\'charging:change\', function (value) {\n     //...doStuff();\n});\n\n//connect the controller\ncontroller.connect();\n\n~~~~\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Ricardo de Pena\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the "Software"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n',
34 silly install resolved     bugs: { url: 'https://github.com/rdepena/node-dualshock-controller/issues' },
34 silly install resolved     homepage: 'https://github.com/rdepena/node-dualshock-controller',
34 silly install resolved     _id: 'dualshock-controller@0.6.7',
34 silly install resolved     _from: 'dualshock-controller@*' } ]
35 info install dualshock-controller@0.6.7 into /Users/cameron
36 info installOne dualshock-controller@0.6.7
37 verbose installOne of dualshock-controller to /Users/cameron not in flight; installing
38 warn locking Error: EACCES, open '/Users/cameron/.npm/_locks/dualshock-controller-9e52df7f44f09058.lock'
38 warn locking  /Users/cameron/.npm/_locks/dualshock-controller-9e52df7f44f09058.lock failed { [Error: EACCES, open '/Users/cameron/.npm/_locks/dualshock-controller-9e52df7f44f09058.lock']
38 warn locking   errno: 3,
38 warn locking   code: 'EACCES',
38 warn locking   path: '/Users/cameron/.npm/_locks/dualshock-controller-9e52df7f44f09058.lock' }
39 verbose stack Error: Attempt to unlock /Users/cameron/node_modules/dualshock-controller, which hasn't been locked
39 verbose stack     at unlock (/usr/local/lib/node_modules/npm/lib/utils/locker.js:66:11)
39 verbose stack     at cb (/usr/local/lib/node_modules/npm/lib/install.js:929:5)
39 verbose stack     at /usr/local/lib/node_modules/npm/lib/install.js:933:20
39 verbose stack     at /usr/local/lib/node_modules/npm/lib/utils/locker.js:40:9
39 verbose stack     at cb (/usr/local/lib/node_modules/npm/node_modules/lockfile/lockfile.js:149:38)
39 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/lockfile/lockfile.js:177:38
39 verbose stack     at Object.oncomplete (fs.js:107:15)
40 verbose cwd /Users/cameron
41 error Darwin 14.0.0
42 error argv "node" "/usr/local/bin/npm" "install" "dualshock-controller"
43 error node v0.10.33
44 error npm  v2.1.11
45 error Attempt to unlock /Users/cameron/node_modules/dualshock-controller, which hasn't been locked
46 error If you need help, you may report this error at:
46 error     <http://github.com/npm/npm/issues>
47 verbose exit [ 1, true ]

Even if I do:

sudo npm install dualshock-contoller

it breaks

rdepena commented 9 years ago

Strange, I will take a look at it this afternoon.

iamdriz commented 9 years ago

@rdepena Any updates? Thanks

rdepena commented 9 years ago

hey @iamdriz, tried last night and was not able to reproduce on two different machines, I think this might be a issue with NPM being in a bad state, can you try to delete this folder: "/Users/cameron/node_modules/dualshock-controller" and either retry or check who owns the node installation: http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo/24404451#24404451

rdepena commented 9 years ago

@iamdriz check out this issue, seems like its a similar problem:

https://github.com/npm/npm/issues/6663

rdepena commented 9 years ago

Hey @iamdriz is this still an issue ?

0lumide commented 9 years ago

This is also an issue for me. I installed node using sudo apt-get install nodejs and when I try to install dualshock with npm install dualshock-controller it gives me this error

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/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:797:12)
gyp ERR! System Linux 3.13.0-45-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "configure" "build" "install"
gyp ERR! cwd /home/olumide/node_modules/dualshock-controller/node_modules/node-hid
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! weird error 1
npm ERR! not ok code 0
rdepena commented 9 years ago

Hey @0lumide what flavor of linux and version of node are you using ?

rdepena commented 9 years ago

Hey @0lumide, looks like I the issue is one of the modules I am using does not work with never version of node, there is already a pull request to fix it: https://github.com/node-hid/node-hid/pull/69

I would recommend using https://github.com/creationix/nvm in the meantime, I will keep an eye on the PR.

0lumide commented 9 years ago

@rdepena Ah thanks! I'll try using nvm

0lumide commented 9 years ago

Just incase anybody has this problem, it appears like I was missing a depeendecy for node-hid node-hid dependecies. Particularly libusb

itaisteinherz commented 5 years ago

Is this still an issue? @iamdriz @0lumide