Saya mencoba mengatur TensorFlow untuk aplikasi demo namun saya memiliki beberapa masalah dalam membangunnya, saya mendapatkan kesalahan berikut setiap kali saya npm install @tensorflow/tfjs-node :

CPU-windows-2.8.1.zip
* Downloading libtensorflow
[==============================] 34893663/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-v5/2.8.1/CPU-windows-2.8.1.zip
node-pre-gyp WARN Pre-built binaries not found for @tensorflow/tfjs-node@2.8.1 and node@12.13.0 (node-v72 ABI, unknown) (falling back to source compile with node-gy
p)
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.18363
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=C:\\Users\\MyUser\\WebstormProjects\\baseball\\node_modules\\@tensorflow\\tfjs-node\\lib\\napi-v5\\tfjs_binding.node" "--module_name=tfjs_binding"
 "--module_path=C:\\Users\\MyUser\\WebstormProjects\\baseball\\node_modules\\@tensorflow\\tfjs-node\\lib\\napi-v5" "--napi_version=5" "--node_abi_napi=napi" "--napi_b
uild_version=5" "--node_napi_label=napi-v5"
gyp ERR! cwd C:\Users\MyUser\WebstormProjects\baseball\node_modules\@tensorflow\tfjs-node
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
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 bu
ild --fallback-to-build --module=C:\Users\MyUser\WebstormProjects\baseball\node_modules\@tensorflow\tfjs-node\lib\napi-v5\tfjs_binding.node --module_name=tfjs_binding
 --module_path=C:\Users\MyUser\WebstormProjects\baseball\node_modules\@tensorflow\tfjs-node\lib\napi-v5 --napi_version=5 --node_abi_napi=napi --napi_build_version=5 -
-node_napi_label=napi-v5' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\MyUser\WebstormProjects\baseball\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Windows_NT 10.0.18363
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\MyUser\\WebstormProjects\\baseball\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "instal
l" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\MyUser\WebstormProjects\baseball\node_modules\@tensorflow\tfjs-node
node-pre-gyp ERR! node -v v12.13.0
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok

Versi simpul: 12.13.0

Sistem operasi saya adalah Windows

Python --versi: Python 2.7.18

Adakah yang bisa memberi tahu saya apa yang telah saya lakukan salah?

Perbarui

Jadi saya melihat melalui kesalahan dan menemukan detail kecil:

Garis ini:

node-pre-gyp WARN Tried to download(404): https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v5/2.8.1/CPU-windows-2.8.1.zip

Jika saya membuka URL itu, saya mendapatkan 404 dengan benar (atau halaman tidak ditemukan)

Jadi mungkin itu? bagaimana cara menemukan file itu?

2
Marc Rasmussen 22 Desember 2020, 03:18

3 jawaban

Jawaban Terbaik

Menurut Kesalahan th:

node-pre-gyp WARN Tried to download(404): https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v5/2.8.1/CPU-windows-2.8.1.zip

Dan berdasarkan masalah ini, Tampaknya mungkin ada masalah dengan instalasi prasyarat Anda . Jadi mungkin tautan berikut dapat membantu Anda mengatasi masalah Anda:

instal node-gyp di windows

Kesalahan saat menginstal node-gpu(masalah ini tentang gpu tetapi masalah utamanya sama dengan masalahmu)

1
pouyan 26 Desember 2020, 00:35

Anda harus menginstal python 3, dengan versi python yang Anda miliki TensorFlow tidak akan dibangun. https://www.tensorflow.org/install

0
Guilherme Féria 24 Desember 2020, 17:14

Saya memiliki masalah yang sama dan ketika saya menggunakan python 3 alih-alih python 2, itu berhasil untuk saya. Coba instal Python 3.8.3

0
srishtigarg 24 Desember 2020, 17:17