tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.51k stars 1.93k forks source link

throw new Error("The Node.js native addon module (tfjs_binding.node) can not " + ^ Error: The Node.js native addon module (tfjs_binding.node) can not be found at path: C:\Users\Desktop\Facial Recognition\backend-server\node_modules\@tensorflow\tfjs-node\lib\napi-v7\tfjs_binding.node. #8416

Closed supraj221 closed 1 month ago

supraj221 commented 1 month ago

gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli 'C:\Program Files\nodejs\node.exe',
gyp verb cli 'C:\Users\rajgi\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js', gyp verb cli 'configure', gyp verb cli '--verbose' gyp verb cli ] gyp info using node-gyp@10.2.0 gyp info using node@20.17.0 | win32 | x64 gyp verb find Python Python is not set from command line or npm configuration gyp verb find Python Python is not set from environment variable PYTHON gyp verb find Python checking if the py launcher can be used to find Python 3 gyp verb find Python - executing "py.exe" to get Python 3 executable path gyp verb find Python - executable path is "C:\Users\rajgi\AppData\Local\Programs\Python\Python312\python.exe" gyp verb find Python - executing "C:\Users\rajgi\AppData\Local\Programs\Python\Python312\python.exe" to get version gyp verb find Python - version is "3.12.2" gyp info find Python using Python version 3.12.2 found at "C:\Users\rajgi\AppData\Local\Programs\Python\Python312\python.exe" gyp verb get node dir no --target version specified, falling back to host node version: 20.17.0

gyp verb install input version string "20.17.0"
gyp verb install installing version: 20.17.0 gyp verb install --ensure was passed, so won't reinstall if already installed gyp verb install version is already installed, need to check "installVersion" gyp verb got "installVersion" 11 gyp verb needs "installVersion" 11 gyp verb install version is good gyp verb on Windows; need to check node.lib gyp verb get node dir target node version installed: 20.17.0 gyp verb build dir attempting to create "build" dir: C:\Users\rajgi\OneDrive\Desktop\VNIT\Attendance Facial Recognition\backend-server\build gyp verb build dir "build" dir needed to be created? No gyp verb find VS msvs_version not set from command line or npm config gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt gyp verb find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. gyp verb find VS gyp verb find VS Failure details: undefined gyp verb find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. gyp verb find VS gyp verb find VS Failure details: undefined gyp verb find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. gyp verb find VS gyp verb find VS Failure details: undefined gyp verb find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. gyp verb find VS gyp verb find VS Failure details: undefined gyp verb find VS not looking for VS2015 as it is only supported up to Node.js 18 gyp verb find VS not looking for VS2013 as it is only supported up to Node.js 8 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 could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. gyp ERR! find VS gyp ERR! find VS Failure details: undefined gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. gyp ERR! find VS gyp ERR! find VS Failure details: undefined gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. gyp ERR! find VS gyp ERR! find VS Failure details: undefined gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. gyp ERR! find VS gyp ERR! find VS Failure details: undefined gyp ERR! find VS not looking for VS2015 as it is only supported up to Node.js 18 installation to use gyp ERR! stack at VisualStudioFinder.fail (C:\Users\rajgi\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:118:11) gyp ERR! stack at VisualStudioFinder.findVisualStudio (C:\Users\rajgi\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:17) gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:95:5) gyp ERR! stack at async createBuildDir (C:\Users\rajgi\installation to use gyp ERR! stack at VisualStudioFinder.fail (C:\Users\rajgi\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:118:11) gyp ERR! stack at VisualStudioFinder.findVisualStudio (C:\Users\rajgi\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:17) gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:95:5) gyp ERR! stack at async createBuildDir (C:\Users\rajgi\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:112:18) gyp ERR! stack at async run (C:\Users\rajgi\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js:81:18)
gyp ERR! System Windows_NT 10.0.22631 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\rajgi\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--verbose"
gyp ERR! cwd C:\Users\rajgi\OneDrive\Desktop\VNIT\Attendance Facial Recognition\backend-server gyp ERR! node -v v20.17.0 gyp ERR! node-gyp -v v10.2.0 gyp ERR! not ok

shmishra99 commented 1 month ago

Hi @supraj221 ,

Thank you for reporting this issue. I can see in logs you're using Python 3.12.2 and Node.js v20.17.0. TensorFlow.js currently doesn't support Python 3.12.x.

To resolve this, please use a Python version between 3.7.x and 3.11.x or Node.js v20.15.0 or v19.9.0.

Then, run the following command:

npm install
npm update
npm rebuild bcrypt --build-from-source
npm rebuild @tensorflow/tfjs-node build-addon-from-source

Please try these steps and let me know if the issue is resolved."

shmishra99 commented 1 month ago

Alternatively, if you prefer not to rebuild the entire project, you can manually copy the file.

cp node_modules/\@tensorflow/tfjs-node/deps/lib/tensorflow.dll node_modules/\@tensorflow/tfjs-node/lib/napi-v8/

Thank You!!

supraj221 commented 1 month ago

Thanks! I actually didn't have Visual Studio Build Tools with the "Desktop development with C++" workload, then installed tfjs-node again and then copied the dll file

the issue is now resolved

google-ml-butler[bot] commented 1 month ago

Are you satisfied with the resolution of your issue? Yes No