最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Unable to "npm install @tensorflowtfjs-node" - Stack Overflow

programmeradmin2浏览0评论

I'm trying to install Node.js bindings for tensorflow.js. However, when I run "npm install @tensorflow/tfjs-node", I get the following output. Any help will be appreciated. Thank you!

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

> @tensorflow/[email protected] 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! mand "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 [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/[email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/[email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A plete 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

I'm trying to install Node.js bindings for tensorflow.js. However, when I run "npm install @tensorflow/tfjs-node", I get the following output. Any help will be appreciated. Thank you!

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

> @tensorflow/[email protected] 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! mand "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 [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/[email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/[email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A plete 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
Share Improve this question edited Jun 23, 2018 at 19:01 Asym asked Jun 23, 2018 at 18:54 AsymAsym 1,9383 gold badges22 silver badges39 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

I may be wrong, but you're using Windows but as I can see on the npmjs. – tfjs-node is available on Linux and macOS only.

TensorFlow.js for Node currently supports the following platforms:

  1. Mac OS X CPU (10.12.6 Siera or higher)
  2. Linux CPU (Ubuntu 16.04 or higher)
  3. Linux GPU (Ubuntu 16.04 or higher and Cuda 9.0 w/ CUDNN v7) (see installation instructions)

Finally, i can run TensorFlow.js Node sample on Windows. Indeed, it runs on Ubuntu WSL (Windows Subsystem for Linux).

  1. Enable WSL with powershell and install Ubuntu WSL from Microsoft Store.
  2. Install several tool in Ubuntu WSL by apt-get, including NodeJS, Make, G++. Because the warning message is vague, I nearly gave up.
  3. optional: Running Node.js on WSL from Visual Studio Code

I may missed some trivial steps.

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.

Please refer: https://github./caisq/tfjs-node for more details!

发布评论

评论列表(0)

  1. 暂无评论