2012-10-18 8 views
10

Ich versuche opencv für den Knoten zu installieren. Ich glaube nicht, dass dies direkt mit opencv zu tun hat, sondern mit node-gyp. Ich hatte Erfolg opencv auf meinem Mac in der Installation, aber wenn ich versuche, genau das gleiche auf Ubuntu Server zu tun ich die folgende Fehlermeldung nach ‚npm ​​installieren opnecv‘ tun:Fehler: „pre“ Versionen des Knotens kann nicht installiert werden, verwenden Sie die --nodedir Flag statt

npm http GET https://registry.npmjs.org/opencv 
npm http 304 https://registry.npmjs.org/opencv 

> [email protected] preinstall /home/demo/node_modules/opencv 
> node-gyp rebuild 

gyp ERR! configure error 
gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead 
gyp ERR! stack  at install (/usr/local/lib/node_modules/node-gyp/lib/install.js:69:16) 
gyp ERR! stack  at Object.commands.forEach.self.commands.(anonymous function) [as install] (/usr/local/lib/node_modules/node-gyp/lib/node-gyp.js:56:37) 
gyp ERR! stack  at getNodeDir (/usr/local/lib/node_modules/node-gyp/lib/configure.js:181:20) 
gyp ERR! stack  at /usr/local/lib/node_modules/node-gyp/lib/configure.js:101:9 
gyp ERR! stack  at ChildProcess.exithandler (child_process.js:538:7) 
gyp ERR! stack  at ChildProcess.EventEmitter.emit (events.js:96:17) 
gyp ERR! stack  at maybeClose (child_process.js:638:16) 
gyp ERR! stack  at Process._handle.onexit (child_process.js:680:5) 
gyp ERR! System Linux 3.2.0-29-generic 
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild" 
gyp ERR! cwd /home/demo/node_modules/opencv 
gyp ERR! node -v v0.8.13-pre 
gyp ERR! node-gyp -v v0.7.1 
gyp ERR! not ok 
npm ERR! [email protected] preinstall: `node-gyp rebuild` 
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1 
npm ERR! 
npm ERR! Failed at the [email protected] preinstall script. 
npm ERR! This is most likely a problem with the opencv package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  node-gyp rebuild 
npm ERR! You can get their info via: 
npm ERR!  npm owner ls opencv 
npm ERR! There is likely additional logging output above. 

npm ERR! System Linux 3.2.0-29-generic 
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "opencv" 
npm ERR! cwd /home/demo 
npm ERR! node -v v0.8.13-pre 
npm ERR! npm -v 1.1.63 
npm ERR! code ELIFECYCLE 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /home/demo/npm-debug.log 
npm ERR! not ok code 0 

Ich habe auch versucht Herunterladen des Quellcodes und macht 'node-gyp rebuild' mit ähnlichen Ergebnissen:

[email protected]:~/src/node$ node-gyp rebuild 
gyp info it worked if it ends with ok 
gyp info using [email protected] 
gyp info using [email protected] | linux | x64 
gyp ERR! configure error 
gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead 
gyp ERR! stack  at install (/usr/local/lib/node_modules/node-gyp/lib/install.js:69:16) 
gyp ERR! stack  at Object.commands.forEach.self.commands.(anonymous function) [as install] (/usr/local/lib/node_modules/node-gyp/lib/node-gyp.js:56:37) 
gyp ERR! stack  at getNodeDir (/usr/local/lib/node_modules/node-gyp/lib/configure.js:181:20) 
gyp ERR! stack  at /usr/local/lib/node_modules/node-gyp/lib/configure.js:101:9 
gyp ERR! stack  at ChildProcess.exithandler (child_process.js:538:7) 
gyp ERR! stack  at ChildProcess.EventEmitter.emit (events.js:96:17) 
gyp ERR! stack  at maybeClose (child_process.js:638:16) 
gyp ERR! stack  at Process._handle.onexit (child_process.js:680:5) 
gyp ERR! System Linux 3.2.0-29-generic 
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild" 
gyp ERR! cwd /home/demo/src/node 
gyp ERR! node -v v0.8.13-pre 
gyp ERR! node-gyp -v v0.7.1 
gyp ERR! not ok 

Hat jemand dieses Problem schon mal gehabt?

+0

BTW, warum bist du Verwenden Sie Node.js 0.8.13 und nicht die stabile Version 0.8.12? –

+0

Whoops, das war nicht meine Absicht. Ich werde zu 0.8.12 wechseln. –

Antwort

16

Verwenden Sie npm install --nodedir=/path/to/node opencv, wobei /path/to/node ein Pfad zum aktuellen nodejs-Quellcode ist.

Es geschieht, weil Knoten-gyp nicht Quelle zu Ihrer benutzerdefinierten Build finden, und hier ist die Diskussion darüber: https://github.com/TooTallNate/node-gyp/issues/86

Sie können dies häufig beheben, indem Sie einen symbolischen Link zu schaffen, wenn Sie Superuser-Berechtigungen verfügen.

chmod a+r /path/to/node -R 
cd /usr/lib 
sudo ln -s /path/to/node node 

Dann npm install wieder, und es wird es wahrscheinlich finden. Tun Sie dies nicht, wenn/usr/lib/node bereits existiert, da andere Software davon abhängen kann.

+0

ein Leben gerettet heute – Rafay

20

ich auch in der Lage war, dies zu einer stabilen Version durch ein Upgrade meiner Version von Knoten zu lösen (zB nicht eine „pre“ Version - Ihre Version ist 0.8.13-pre) mit folgenden:

sudo npm install -g n # install node version manager "n" 
sudo n stable # install the latest stable version of node 
+0

Vielen Dank! Nur so hat das Problem gelöst –