gpt4 book ai didi

javascript - 无法 "npm install @tensorflow/tfjs-node"

转载 作者:搜寻专家 更新时间:2023-11-01 00:19:53 24 4
gpt4 key购买 nike

我正在尝试为 tensorflow.js 安装 Node.js 绑定(bind)。但是,当我运行“npm install @tensorflow/tfjs-node”时,我得到以下输出。任何帮助将不胜感激。谢谢!

D:\tensorflow.js>npm install @tensorflow/tfjs-node

> @tensorflow/tfjs-node@0.1.7 install D:\tensorflow.js\node_modules\@tensorflow\tfjs-node
> node-gyp rebuild


D:\tensorflow.js\node_modules\@tensorflow\tfjs-node>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node
"" rebuild )
gyp: Undefined variable tensorflow-library-target in binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.16299
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 D:\tensorflow.js\node_modules\@tensorflow\tfjs-node
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN tensorflow@1.0.0 No description
npm WARN tensorflow@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node@0.1.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/tfjs-node@0.1.7 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\Myuser\AppData\Roaming\npm-cache\_logs\2018-06-23T18_50_36_025Z-debug.log

最佳答案

终于,我可以在 Windows 上运行 TensorFlow.js Node 示例了。实际上,它在 Ubuntu WSL(适用于 Linux 的 Windows 子系统)上运行。

  1. 使用 powershell 启用 WSL 并从 Microsoft Store 安装 Ubuntu WSL。
  2. 通过apt-get在Ubuntu WSL中安装几个工具,包括NodeJS、Make、G++。由于警告信息含糊不清,我差点放弃。
  3. 可选:Running Node.js on WSL from Visual Studio Code

我可能错过了一些琐碎的步骤。

关于javascript - 无法 "npm install @tensorflow/tfjs-node",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51004170/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com