Prz*_*ach 10 opencv node.js npm
我正在尝试为节点安装opencv.我认为这与opencv没有直接关系,而是与node-gyp有关.我成功地在我的mac上安装opencv但是当我尝试在Ubuntu服务器上完全相同时,我在执行'npm install opnecv'后得到以下错误:
npm http GET https://registry.npmjs.org/opencv
npm http 304 https://registry.npmjs.org/opencv
> opencv@0.0.7 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! opencv@0.0.7 preinstall: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the opencv@0.0.7 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
Run Code Online (Sandbox Code Playgroud)
我也尝试下载源代码并执行'node-gyp rebuild',结果类似:
demo@camera:~/src/node$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@0.7.1
gyp info using node@0.8.13-pre | 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
Run Code Online (Sandbox Code Playgroud)
以前有人有这个问题吗?
tob*_*bek 20
我还能够通过将我的节点版本升级到稳定版本(例如,不是"预"版本 - 您的版本0.8.13-pre)来解决这个问题,具体如下:
sudo npm install -g n # install node version manager "n"
sudo n stable # install the latest stable version of node
Run Code Online (Sandbox Code Playgroud)
ale*_*lex 16
Use npm install --nodedir=/path/to/node opencv, where /path/to/node is a path to current nodejs source code.
It happens because node-gyp can't find source to your custom build, and here is the discussion about it: https://github.com/TooTallNate/node-gyp/issues/86
You can commonly fix this by creating a symbolic link if you have super user permissions.
chmod a+r /path/to/node -R
cd /usr/lib
sudo ln -s /path/to/node node
Run Code Online (Sandbox Code Playgroud)
Then npm install again, and it will likely find it. Don't do this if /usr/lib/node already exists, as other software may depend on it.
| 归档时间: |
|
| 查看次数: |
14009 次 |
| 最近记录: |