简体   繁体   English

无法“ npm install @ tensorflow / tfjs-node”

[英]Unable to “npm install @tensorflow/tfjs-node”

I'm trying to install Node.js bindings for tensorflow.js. 我正在尝试为tensorflow.js安装Node.js绑定。 However, when I run "npm install @tensorflow/tfjs-node", I get the following output. 但是,当我运行“ npm install @ tensorflow / tfjs-node”时,得到以下输出。 Any help will be appreciated. 任何帮助将不胜感激。 Thank you! 谢谢!

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

Finally, i can run TensorFlow.js Node sample on Windows. 最后,我可以在Windows上运行TensorFlow.js Node示例。 Indeed, it runs on Ubuntu WSL (Windows Subsystem for Linux). 实际上,它可以在Ubuntu WSL(Linux的Windows子系统)上运行。

  1. Enable WSL with powershell and install Ubuntu WSL from Microsoft Store. 使用powershell启用WSL并从Microsoft Store安装Ubuntu WSL。
  2. Install several tool in Ubuntu WSL by apt-get, including NodeJS, Make, G++. 通过apt-get在Ubuntu WSL中安装几个工具,包括NodeJS,Make,G ++。 Because the warning message is vague, I nearly gave up. 由于警告信息含糊不清,我几乎放弃了。
  3. optional: Running Node.js on WSL from Visual Studio Code 可选: 从Visual Studio Code在WSL上运行Node.js

I may missed some trivial steps. 我可能错过了一些琐碎的步骤。

I may be wrong, but you're using Windows but as I can see on the npmjs.com – tfjs-node is available on Linux and macOS only. 我可能是错的,但是您使用的是Windows,但是正如我在npmjs.com上看到的那样 – tfjs-node仅在Linux和macOS上可用。

TensorFlow.js for Node currently supports the following platforms: TensorFlow.js for Node当前支持以下平台:

  1. Mac OS X CPU (10.12.6 Siera or higher) Mac OS X CPU(10.12.6 Siera或更高版本)
  2. Linux CPU (Ubuntu 16.04 or higher) Linux CPU(Ubuntu 16.04或更高版本)
  3. Linux GPU (Ubuntu 16.04 or higher and Cuda 9.0 w/ CUDNN v7) (see installation instructions) Linux GPU(Ubuntu 16.04或更高版本以及Cuda 9.0 w / CUDNN v7)(请参阅安装说明)

You also need to make sure that you are using Python 2.7 and not Python3.* The best option would be to create a new virtualEnv with python 2.7 and then do the installation. 您还需要确保使用的是Python 2.7,而不是Python3。*最好的选择是使用python 2.7创建一个新的virtualEnv,然后进行安装。

Please refer: https://github.com/caisq/tfjs-node for more details! 请参阅: https//github.com/caisq/tfjs-node了解更多详细信息!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Node.js(tfjs-node)从Tensorflow.js中的检查点重新启动模型训练? - How to restart a model training from a check point in Tensorflow.js with Node.js (tfjs-node)? 找不到 \node_modules\@tensorflow\tfjs-node\lib\napi-v4\tfjs_binding.node - Cant find \node_modules\@tensorflow\tfjs-node\lib\napi-v4\tfjs_binding.node 使用 face-api.js 时导入 @tensorflow/tfjs-node 的问题 package (node.js) - problem with importing @tensorflow/tfjs-node while working with face-api.js package (node.js) 如何使用 @tensorflow/tfjs-node v2 保存 model? - How do I save a model using @tensorflow/tfjs-node v2? 平台浏览器已经设置。 用 [object Object] 覆盖平台。 在电子应用程序中使用 tfjs-node 时 - Platform browser has already been set. Overwriting the platform with [object Object]. when using tfjs-node in electron app 无法在node.js中安装npm软件包 - unable to install npm packages in node.js 在@tensorflow 安装文件夹中找不到“tfjs_binding.node” - “tfjs_binding.node” not found in @tensorflow installed folder Tensorflow JS tfjs | 无法使用 tf.loadLayersModel 加载 model - Tensorflow JS tfjs | Unable to load model using tf.loadLayersModel npm 无法安装 scrypt。 节点gyp重建 - npm unable to install scrypt. node-gyp rebuild TensorFlow(tfjs)“图形管道停顿” - TensorFlow (tfjs) “graphics pipeline stall”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM