question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't build tfjs-node on Windows 10; module_name not defined in binding.gyp.

See original GitHub issue

I’m unable to run tfjs-node. It reports a missing bindings file. I see the file in my project, but I haven’t found a way to include it (via import or require).

I’m not certain, but it looks like “module_name” is referenced without being defined in binding.gyp

Hope this helps.

VS Code Windows 10 x64 node 14.13.1 python 2.7.17

Stack: (WORKSPACE)\node_modules@tensorflow\tfjs-node>node-gyp configure --verbose 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:\…\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@7.1.0 gyp info using node@14.13.1 | win32 | x64 gyp verb command configure [] 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 “python3” can be used gyp verb find Python - executing “python3” to get executable path gyp verb find Python - “python3” is not in PATH or produced an error gyp verb find Python checking if “python” can be used gyp verb find Python - executing “python” to get executable path gyp verb find Python - executable path is “C:\Python27\python.exe” gyp verb find Python - executing “C:\Python27\python.exe” to get version gyp verb find Python - version is “2.7.17” gyp info find Python using Python version 2.7.17 found at “C:\Python27\python.exe” gyp verb get node dir no --target version specified, falling back to host node version: 14.13.1 gyp verb command install [ ‘14.13.1’ ] gyp verb install input version string “14.13.1” gyp verb install installing version: 14.13.1 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” 9 gyp verb needs “installVersion” 9 gyp verb install version is good gyp verb get node dir target node version installed: 14.13.1 gyp verb build dir attempting to create “build” dir: C:\Users.…\PROJECT\node_modules@tensorflow\tfjs-node\build gyp verb build dir “build” dir needed to be created? C:\Users.…\PROJECT\node_modules@tensorflow\tfjs-node\build 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 checking VS2017 (15.9.28307.960) found at: gyp verb find VS “C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools” gyp verb find VS - found “Visual Studio C++ core features” gyp verb find VS - found VC++ toolset: v141 gyp verb find VS - found Windows SDK: 10.0.17763.0 gyp info find VS using VS2017 (15.9.28307.960) found at: gyp info find VS “C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools” gyp info find VS run with --verbose for detailed information gyp verb build/config.gypi creating config file gyp verb build/config.gypi writing out config file: C:\Users.…\PROJECT\node_modules@tensorflow\tfjs-node\build\config.gypi gyp verb config.gypi checking for gypi file: C:\Users.…\PROJECT\node_modules@tensorflow\tfjs-node\config.gypi gyp verb common.gypi checking for gypi file: C:\Users.…\PROJECT\node_modules@tensorflow\tfjs-node\common.gypi gyp verb gyp gyp format was not specified; forcing “msvs” gyp info spawn C:\Python27\python.exe gyp info spawn args [ gyp info spawn args ‘C:\Users\…\AppData\Roaming\npm\node_modules\node-gyp\gyp\gyp_main.py’, gyp info spawn args ‘binding.gyp’, gyp info spawn args ‘-f’, gyp info spawn args ‘msvs’, gyp info spawn args ‘-I’, gyp info spawn args ‘C:\Users\…\OneDrive\…\node_modules\@tensorflow\tfjs-node\build\config.gypi’, gyp info spawn args ‘-I’, gyp info spawn args ‘C:\Users\…\AppData\Roaming\npm\node_modules\node-gyp\addon.gypi’, gyp info spawn args ‘-I’, gyp info spawn args ‘C:\Users\…\AppData\Local\node-gyp\Cache\14.13.1\include\node\common.gypi’, gyp info spawn args ‘-Dlibrary=shared_library’, gyp info spawn args ‘-Dvisibility=default’, gyp info spawn args ‘-Dnode_root_dir=C:\Users\…\AppData\Local\node-gyp\Cache\14.13.1’, gyp info spawn args ‘-Dnode_gyp_dir=C:\Users\…\AppData\Roaming\npm\node_modules\node-gyp’, gyp info spawn args ‘-Dnode_lib_file=C:\\Users\\…\\AppData\\Local\\node-gyp\\Cache\\14.13.1\\<(target_arch)\\node.lib’, gyp info spawn args ‘-Dmodule_root_dir=C:\Users\…\OneDrive\…\node_modules\@tensorflow\tfjs-node’, gyp info spawn args ‘-Dnode_engine=v8’, gyp info spawn args ‘–depth=.’, gyp info spawn args ‘–no-parallel’, gyp info spawn args ‘–generator-output’, gyp info spawn args ‘C:\Users\…\OneDrive\…\node_modules\@tensorflow\tfjs-node\build’, gyp info spawn args ‘-Goutput_dir=.’ gyp info spawn args ] gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (C:\Users.…\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:351:16) gyp ERR! stack at ChildProcess.emit (events.js:314:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12) gyp ERR! System Windows_NT 10.0.18362 gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Users\…\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js” “configure” “–verbose” gyp ERR! cwd C:\Users.…\PROJECT\node_modules@tensorflow\tfjs-node gyp ERR! node -v v14.13.1 gyp ERR! node-gyp -v v7.1.0 gyp ERR! not ok

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ZhangTianrongcommented, Apr 12, 2021

Looks good! I manually copied the dll as mentioned in #4257, and tfjs-node now imports and runs correctly. Thanks!!

Hi, I am encountering the same problem. How did you copied the dll? I cannot find it anywhere.

Edit: Well, I just forced everything to look the same as it requires, like I see napi-v7 in my module and I created a soft link name napi-v8. After that, it seems like installed without a problem. In case anyone is facing the same issue and doesn’t known much about node.js just like me, here is the code in powershell.

npm install @tensorflow/tfjs-node --ignore-scripts #prevent downloaded files to be deleted on failed install
cd .\node_modules\@tensorflow\tfjs-node\lib\
sudo New-Item -Path .\napi-v8 -ItemType SymbolicLink -Value .\napi-v7
cd ..\..\..\..\
npm rebuild @tensorflow/tfjs-node --build-from-source
1reaction
pyu10055commented, Nov 23, 2020

@joemullenix-ks Looks like your issue is related to this bug https://github.com/tensorflow/tfjs/issues/4257, basically the dll file is not copied properly, when the node version is > 14.x

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to install @tensorflow/tfjs-node with npm
I tried using 'npm i @tensorflow/tfjs-node@1.2.8', but still it seems to get to a 404 error: * Building TensorFlow Node.js bindings node-pre-gyp ...
Read more >
@mapbox/node-pre-gyp - npm
A new target must be added to binding.gyp that moves the compiled .node module from ./build/Release/module_name.node into the directory ...
Read more >
TensorFlow.js in Node
This package will work on Linux, Windows, and Mac platforms where TensorFlow is supported. Note: You do not have to import '@tensorflow/tfjs' or ......
Read more >
npm tracker "idealtree" already exists - You.com | The Search ...
This issue is happening due to changes in NodeJS starting with version 15. When no WORKDIR is specified, npm install is executed in...
Read more >
Environments for running AI in Node.js - IBM Developer
Because of the dependency of the prebuilt TensorFlow C binary, the npm package supports a specific set of environments. You can find the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found