首页 > 解决方案 > 节点 gyp 重建失败:错误:命令失败:节点 gyp 重建

问题描述

我正在尝试tensorflow为节点安装,似乎npm i @tensorflow/tfjs-node应该完成工作,但我遇到了这个与 python 有关的奇怪问题。前段时间我确实安装了 python,但我对此几乎一无所知。

    @tensorflow/tfjs-node@0.1.17 install C:\tf\node_modules\@tensorflow\tfjs-node
> node scripts/install.js

* Downloading libtensorflow
[==============================] 1479154/bps 100% 0.0s
* Building TensorFlow Node.js bindings
C:\tf\node_modules\@tensorflow\tfjs-node\scripts\install.js:154
      throw new Error('node-gyp rebuild failed with: ' + err);
      ^

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:/Anaconda/python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\tf\node_modules\@tensorflow\tfjs-node
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

    at cp.exec (C:\tf\node_modules\@tensorflow\tfjs-node\scripts\install.js:154:13)
    at ChildProcess.exithandler (child_process.js:282:5)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npm WARN knn-tf@1.0.0 No description
npm WARN knn-tf@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node@0.1.17 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/tfjs-node@0.1.17 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Paras\AppData\Roaming\npm-cache\_logs\2019-01-19T17_31_39_415Z-debug.log

标签: pythonnode.jstensorflow.js

解决方案


推荐阅读