question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Npm installation fails.

See original GitHub issue

Update: The original content of this thread is not important any more. Please keep 2 things in mind in order to install tenforflow.js successfully. 1, npm could be slow, as you might already know. To solve this, you can update npm to its very latest version or you can try yarn. If you are in China, yarn is generally faster. Also, when you use yarn in windows, you probably get a link from your powershell, open that page, search for Set-ExecutionPolicy. Or you simply type Set-ExecutionPolicy in your powershell and then Bypass and then to all. If you care, set it back to Default after using yarn. 2, Any extra firewall, safety and security software may mess any installation. My A***t messed all my vs2022 updating and npm(and pip when I tried pip install tensorflow). After turning it off, I reinstalled vs2022, and started up with a new react project, yarn installed tfjs, and they all worked again. Notice, I only mean the EXTRA safery softwares, I didn’t turn off the default firewall came along with windows to fix my dev env. 3, A trivial detail. I don’t know how to setup tfjs with pure node.js. But it’s easy to setup with any react template if you use visual studio. I didn’t try but I guess it’s the same way to setup with vue or angular. The key is that, tfjs needs dom. If this update helps or not, please let me know. Feel free to comment in here.

Original content: System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: -
  • TensorFlow.js installed from (npm or script link): npm install @tensorflow/tfjs-node-gpu
  • TensorFlow.js version: 3.12.0
  • CUDA/cuDNN version: CUDA@11.5, cuDNN@8.3.1 #define CUDNN_MAJOR 8 #define CUDNN_MINOR 3 #define CUDNN_PATCHLEVEL 1

Describe the problem I opened up a default react ts project in vs 2022 stable version. View -> terminal. In terminal, npm install @tensorflow/tfjs or tfjs-node or tfjs-node-gpu. None of them works. I also tried npm install in the terminal directly opened from Windows 10 and failed. I don’t know if this issue is caused by the internet since I’m in China. The familiar 404, you know.

Provide the exact sequence of commands / steps that you executed before running into the problem As above.

Any other info / logs npm install @tensorflow/tfjs-node-gpu

@tensorflow/tfjs-node-gpu@3.12.0 install E:\ts practice\tfjs with ts test\tfjsWithTsTest\tfjsWithTsTest\node_modules@tensorflow\tfjs-node-gpu node scripts/install.js gpu download

GPU-windows-3.12.0.zip

  • Downloading libtensorflow https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-2.7.0.zip [==============================] 11266495/bps 100% 0.0s
  • Building TensorFlow Node.js bindings node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.12.0/GPU-windows-3.12.0.zip node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/tfjs-node-gpu@3.12.0 and node@14.17.3 (node-v83 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.12.0/GPU-windows-3.12.0.zip gyp ERR! find VS gyp ERR! find VS msvs_version not set from command line or npm config gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt gyp ERR! find VS unknown version “undefined” found at “C:\Program Files\Microsoft Visual Studio\2022\Community” gyp ERR! find VS checking VS2019 (16.11.31911.196) found at: gyp ERR! find VS “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community” gyp ERR! find VS - found “Visual Studio C++ core features” gyp ERR! find VS - found VC++ toolset: v142 gyp ERR! find VS - missing any Windows SDK gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use gyp ERR! find VS looking for Visual Studio 2015 gyp ERR! find VS - not found gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 gyp ERR! find VS gyp ERR! find VS ************************************************************** gyp ERR! find VS You need to install the latest version of Visual Studio gyp ERR! find VS including the “Desktop development with C++” workload. gyp ERR! find VS For more information consult the documentation at: gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows gyp ERR! find VS ************************************************************** gyp ERR! find VS gyp ERR! configure error gyp ERR! stack Error: Could not find any Visual Studio installation to use gyp ERR! stack at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16 gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14 gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16 gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7 gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16 gyp ERR! stack at ChildProcess.exithandler (child_process.js:326:5) gyp ERR! stack at ChildProcess.emit (events.js:375:28) gyp ERR! stack at maybeClose (internal/child_process.js:1055:16) gyp ERR! System Windows_NT 10.0.19043 gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “configure” “–fallback-to-build” “–module=E:\ts practice\tfjs with ts test\tfjsWithTsTest\tfjsWithTsTest\node_modules\@tensorflow\tfjs-node-gpu\lib\napi-v8\tfjs_binding.node” “–module_name=tfjs_binding” “–module_path=E:\ts practice\tfjs with ts test\tfjsWithTsTest\tfjsWithTsTest\node_modules\@tensorflow\tfjs-node-gpu\lib\napi-v8” “–napi_version=8” “–node_abi_napi=napi” “–napi_build_version=8” “–node_napi_label=napi-v8” gyp ERR! cwd E:\ts practice\tfjs with ts test\tfjsWithTsTest\tfjsWithTsTest\node_modules@tensorflow\tfjs-node-gpu gyp ERR! node -v v14.17.3 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute ‘C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=E:\ts practice\tfjs with ts test\tfjsWithTsTest\tfjsWithTsTest\node_modules@tensorflow\tfjs-node-gpu\lib\napi-v8\tfjs_binding.node --module_name=tfjs_binding --module_path=E:\ts practice\tfjs with ts test\tfjsWithTsTest\tfjsWithTsTest\node_modules@tensorflow\tfjs-node-gpu\lib\napi-v8 --napi_version=8 --node_abi_napi=napi --napi_build_version=8 --node_napi_label=napi-v8’ (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (E:\ts practice\tfjs with ts test\tfjsWithTsTest\tfjsWithTsTest\node_modules@mapbox\node-pre-gyp\lib\util\compile.js:89:23) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:375:28) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1055:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) node-pre-gyp ERR! System Windows_NT 10.0.19043 node-pre-gyp ERR! command “C:\Program Files\nodejs\node.exe” “E:\ts practice\tfjs with ts test\tfjsWithTsTest\tfjsWithTsTest\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp” “install” “–fallback-to-build” node-pre-gyp ERR! cwd E:\ts practice\tfjs with ts test\tfjsWithTsTest\tfjsWithTsTest\node_modules@tensorflow\tfjs-node-gpu node-pre-gyp ERR! node -v v14.17.3 node-pre-gyp ERR! node-pre-gyp -v v1.0.4 node-pre-gyp ERR! not ok

npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.16.0 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @tensorflow/tfjs-node-gpu@3.12.0 install: node scripts/install.js gpu download npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @tensorflow/tfjs-node-gpu@3.12.0 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: One last line is note copied. It’s only a path.

Tomorrow I’ll try installing the python version with pip to check if both ways fail. Btw, would you please add some guide for typescript with tf. The type system is too helpful. Thanks.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:34 (8 by maintainers)

github_iconTop GitHub Comments

9reactions
waki285commented, Mar 22, 2022

I was able to solve this problem. I’ll leave the resolution steps for others to follow.

  1. install build tools from this
  2. install (Be sure to check the C++ box.) image
  3. npm config set msvs_version 2019
  4. npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
  5. Install again
  6. It works!!
3reactions
iXingocommented, Mar 2, 2022

I was able to solve this problem. I’ll leave the resolution steps for others to follow.

  1. install build tools for this
  2. install (Be sure to check the C++ box.) image
  3. npm config set msvs_version 2019
  4. npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
  5. Install again
  6. It works!!

It works for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common errors | npm Docs
Possible temporary npm registry glitch, or corrupted local server cache. Run npm cache clean and/or try again later. · This can be caused...
Read more >
npm install error from the terminal - Stack Overflow
Running just "npm install" will look for dependencies listed in your package.json. The error you're getting says that you don't have a ...
Read more >
NPM install error - Material Design for Bootstrap
Trying to install MDB pro 4.19.2 just downloaded and ran npm install but getting this error of sha512 not matching. Can someone tell...
Read more >
How to Solve the Angular NPM Error - C# Corner
The error in NPM, 'error package install failed, see above', can occur when the user creates a new project in Angular using Node.js...
Read more >
Step by step solution for npm install error - M220JS - MongoDB
Delete the package-lock. · If you see a lot of warning & error messages related to npm-gyp, run npm rebuild & this should...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found