"tfjs_binding.node"在已安装的文件夹中找不到@tensorflow



当我尝试使用张量流的某些功能时,它稍后会给出错误,因为"tfjs_binding.node"@tensorflow在insatlled文件夹中找不到。

我已经安装了Python 2.7,因为它必须在张量流之前作为要求安装。 并通过"python -v"检查其有效性

所以下面是当我尝试安装 @tensorflow/tfjs-node 时。 请帮我清理一些事情...

D:FYP stuffservermakingf_I_upoadt2>npm install @tensorflow/tfjs-node
> @tensorflow/tfjs-node@1.2.11 install D:FYP stuffservermakingf_I_upoadt2node_modules@tensorflowtfjs-node
> node scripts/install.js
CPU-windows-1.2.11.zip
* Downloading libtensorflow
[==============================] 310671/bps 100% 0.0s
[==============================] 355964/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 WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v3/1.2.11/CPU-windows-1.2.11.zip
node-pre-gyp WARN Pre-built binaries not found for @tensorflow/tfjs-node@1.2.11 and node@10.15.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: `C:Program Files (x86)MSBuild12.0binmsbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:Program Filesnodejsnode_modulesnpmnode_modulesnode-gyplibbuild.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=D:\FYP stuff\servermaking\f_I_upoadt2\node_modules\@tensorflow\tfjs-node\lib\napi-v3\tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=D:\FYP stuff\servermaking\f_I_upoadt2\node_modules\@tensorflow\tfjs-node\lib\napi-v3" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd D:FYP stuffservermakingf_I_upoadt2node_modules@tensorflowtfjs-node
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:Program Filesnodejsnode.exe C:Program Filesnodejsnode_modulesnpmnode_modulesnode-gypbinnode-gyp.js build --fallback-to-build --module=D:FYP stuffservermakingf_I_upoadt2node_modules@tensorflowtfjs-nodelibnapi-v3tfjs_binding.node --module_name=tfjs_binding --module_path=D:FYP stuffservermakingf_I_upoadt2node_modules@tensorflowtfjs-nodelibnapi-v3 --napi_version=3 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:FYP stuffservermakingf_I_upoadt2node_modulesnode-pre-gyplibutilcompile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Windows_NT 10.0.17763
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\FYP stuff\servermaking\f_I_upoadt2\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd D:FYP stuffservermakingf_I_upoadt2node_modules@tensorflowtfjs-node
node-pre-gyp ERR! node -v v10.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
npm WARN f_i_upoadt2@1.0.0 No description
npm WARN f_i_upoadt2@1.0.0 No repository field.
+ @tensorflow/tfjs-node@1.2.11
updated 1 package and audited 598 packages in 106.757s
found 0 vulnerabilities

以下是我尝试运行服务器后给出的错误

throw err;
^
Error: Cannot find module 'D:FYP stuffservermakingf_I_upoadt2node_modules@tensorflowtfjs-nodelibnapi-v3tfjs_binding.node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (D:FYP stuffservermakingf_I_upoadt2node_modules@tensorflowtfjs-nodedistindex.js:44:16)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
[nodemon] app crashed - waiting for file changes before starting...

我很乐意得到任何形式的帮助或指导

我在Windows 10上@tensorflow\tfjs节点版本@1.5.2和@1.7.4有同样的问题。节点版本 @12.18.3 LTS

Error: The specified module could not be found.
\?E:hypothesis-managerfacerechttp-servicenode_modules@tensorflowtfjs-nodelibnapi-v5tfjs_binding.node
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1187:18)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (E:hypothesis-managerfacerechttp-servicenode_modules@tensorflowtfjs-nodedistindex.js:58:16)

当我们尝试更新和安装软件包并且某些依赖项未正确安装时,会发生这种情况。 尝试npm uninstall @tensorflowtfjs-node是否正在使用 npm。然后使用npm i @tensorflowtfjs-node安装最新版本的张量流,它将起作用。或者,如果您只希望特定版本的 tensorflow 在您的项目中运行,请尝试遵循下面评论中给出的方法(在我的情况下是@1.5.2(。

  1. 首先,在检查 python 版本时,我必须将 python v2 设置为默认 python。

  2. 我不得不以管理员身份打开Windows Power shell并输入上面显示的命令。

    npm install -g windows-build-tools
    

    花了几分钟,就完成了。

  3. 我也安装了@tensorflow/tfjs,之后@tensorflow/tfjs-node"在我的项目中。

这就是我解决我的问题的方式。

旁注 => Windows 上的某些节点版本存在张量流问题,例如我必须从 v10.16.0 升级到 v10.15.3。

"解决问题的功劳归 Github 上的 tensorflow/tfjs 团队所有">

最新更新