问题:
基本上,我无法为node安装tensorflow的最后一个版本(npm install@tensorflow/tfjs-node(。
主要问题:
我可以使用node.js、node-gip、node-pre-gip、visualstudio代码和python的哪些版本?
作为能够再现错误的以下步骤:
我安装了带有c++包的visual studio社区(2017和2019(
我安装了python 3.10.1
节点gyp配置--msvs_version=2017
npm i-g节点gyp
npm i-g@mapbox/节点预gyp
我还尝试过以下方法:
npm安装--python=python2.7npm配置集python python2.7
然而,看起来这个版本的node-gyp不支持python2.7
错误:
npm ERR! code 1
npm ERR! path C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-node
npm ERR! command failed
npm ERR! command C:Windowssystem32cmd.exe /d /s /c node scripts/install.js
npm ERR! CPU-windows-3.12.0.zip
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.7.0.zip
npm ERR! node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.4
npm ERR! node-pre-gyp info using node@16.13.1 | win32 | x64
npm ERR! node-pre-gyp info check checked for "C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-nodelibnapi-v8tfjs_binding.node" (not found)
npm ERR! node-pre-gyp http GET https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.12.0/CPU-windows-3.12.0.zip
npm ERR! 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/CPU-windows-3.12.0.zip
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/tfjs-node@3.12.0 and node@16.13.1 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! 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/CPU-windows-3.12.0.zip
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@16.13.1 | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@16.13.1 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.1 found at "C:UsersJaviAppDataLocalProgramsPythonPython310python.exe"
npm ERR! gyp info find VS using VS2017 (15.9.28307.1759) found at:
npm ERR! gyp info find VS "C:Program Files (x86)Microsoft Visual Studio2017Community"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:UsersJaviAppDataLocalProgramsPythonPython310python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:UsersJaviAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gypgypgyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-nodebuildconfig.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:UsersJaviAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gypaddon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:UsersJaviAppDataLocalnode-gypCache16.13.1includenodecommon.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:UsersJaviAppDataLocalnode-gypCache16.13.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:UsersJaviAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\Users\Javi\AppData\Local\node-gyp\Cache\16.13.1\<(target_arch)\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-node',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-nodebuild',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@16.13.1 | win32 | x64
npm ERR! gyp info spawn C:/Program Files (x86)/MSBuild/14.0/Bin
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! UNCAUGHT EXCEPTION
npm ERR! gyp ERR! stack Error: spawn C:/Program Files (x86)/MSBuild/14.0/Bin ENOENT
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:477:16)
npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:Program Filesnodejsnode.exe" "C:UsersJaviAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gypbinnode-gyp.js" "build" "--fallback-to-build" "--module=C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-nodelibnapi-v8tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-nodelibnapi-v8" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=8" "--node_napi_label=napi-v8"
npm ERR! gyp ERR! cwd C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-node
npm ERR! gyp ERR! node -v v16.13.1
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! Node-gyp failed to build your package.
npm ERR! gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:Program Filesnodejsnode.exe C:UsersJaviAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gypbinnode-gyp.js build --fallback-to-build --module=C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-nodelibnapi-v8tfjs_binding.node --module_name=tfjs_binding --module_path=C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-nodelibnapi-v8 --napi_version=8 --node_abi_napi=napi --napi_build_version=8 --node_napi_label=napi-v8' (7)
npm ERR! node-pre-gyp ERR! stack at ChildProcess. (C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-nodenode_modules@mapboxnode-pre-gyplibutilcompile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1064:16)
npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19043
npm ERR! node-pre-gyp ERR! command "C:Program Filesnodejsnode.exe" "C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-nodenode_modules@mapboxnode-pre-gypbinnode-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd C:UsersJaviDocumentsGitHubAI_ATest_Composernode_modules@tensorflowtfjs-node
npm ERR! node-pre-gyp ERR! node -v v16.13.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.4
npm ERR! node-pre-gyp ERR! not ok
npm ERR! * Downloading libtensorflow
npm ERR!
npm ERR! * Building TensorFlow Node.js bindings
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersJaviAppDataLocalnpm-cache_logs2022-01-07T13_43_16_353Z-debug-0.log
我尝试过的:
我几乎可以肯定这一定是版本的问题,我尝试了不同的组合。
我在2015年、2017年和2019年尝试了visual studio代码。(2019在尝试节点gyp-configure时出错--msvs_version=2019(。还有node-gip的最后一个版本和3.8.0,因为在一些帖子中我读到它对某人有效,我还尝试了node-pre-gip的不推荐版本以及@mapbox/note-pre-gyp的最后版本。所有这些都在节点16.13.1。
在node的其他版本中,我也尝试过在2015年的visualstudio中使用python 2.7,因为在一些帖子中,这似乎是一个可能的解决方案。
现在我甚至不知道我已经试了两周了,还试了多少其他的东西。最后,我决定发这个帖子来寻求一些帮助。
系统信息:
-Windows 10 x64
-node version 16.13.1 (the current recommended in node js webpage)
-visual studio community 2017 and 2019 installed
-python version 2.7 and 3.10.1 installed
-@tensorflow/tfjs 3.12.0
-@mapbox/node-pre-gyp 1.0.8
-node-gyp 8.4.1
显然,该版本的tfjs节点似乎有问题。降级它很有效,也在ubuntu上运行它。