"tfjs_binding.node" not found in @tensorflow installed folder

Question:

When i try to use some functionalities of tensorflow it later gives and error inshort as “tfjs_binding.node” not found in @tensorflow insatlled folder.

i have installed python 2.7 as it had to be installed as a requirement before tensor flow .. and checked its validty by “python -v” as well

so below is when i try to install @tensorflow/tfjs-node .. help me out clear up things plz …

D:FYP stuffservermakingf_I_upoadt2>npm install @tensorflow/tfjs-node

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

+ @tensorflow/[email protected]
updated 1 package and audited 598 packages in 106.757s
found 0 vulnerabilities


below is the error given after i try to run the server

    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...

I will be glad to have any kind of help or guidance

Asked By: Muhammad Umar Khan

||

Answers:

  1. First I had to set python v2 as default python when on check version of python.

  2. I had to to open Windows Power shell as admin and type in this command shown above.

    npm install -g windows-build-tools
    

    It took several minutes and it was done.

  3. Also I installed @tensorflow/tfjs and after that @tensorflow/tfjs-node" in my project.

That’s how I got to solve my issue.

side note => some certain node versions on Windows have issues with tensor flow, for example I had to upgrade to v10.16.3 from v10.15.0.

"Credits for solving issues goes to tensorflow/tfjs team on Github"

Answered By: Muhammad Umar Khan

I have same problem with @tensorflowtfjs-node version @1.5.2 & @1.7.4 on Windows 10. Node version @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)

This happens when we try to update and install packages, and some dependencies are not installed properly.
Try to npm uninstall @tensorflowtfjs-node if you are using npm. Then install latest version of tensorflow using npm i @tensorflowtfjs-node it will work. Or try following approach given in comment below if you only want particular version of tensorflow to run in your project (In my case it’s @1.5.2).

Answered By: akshay_sushir