SieR-VR/openvr.js

'Could not locate the bindings file' - wrong module_root_dir?

Closed this issue · 10 comments

Your module is used in TS import * as openvr from "openvr.js";

The code is built with WebPack, then run via an npm script which calls node index.js (actually, names have been changed to protect the innocent, but that's not relevant). I run that by pressing the 'play' button in the VSCode 'npm scripts' gui.

This has been working ok on a co-workers system (maybe they invoke the script slightly differently), but on mine I get a runtime error:

Error: Could not locate the bindings file. Tried:
 → <my_project_root>\build\openvr.node
 → <my_project_root>\build\Debug\openvr.node
 → <my_project_root>\build\Release\openvr.node
 → <my_project_root>\out\Debug\openvr.node
 → <my_project_root>\Debug\openvr.node
 → <my_project_root>\out\Release\openvr.node
 → <my_project_root>\Release\openvr.node
 → <my_project_root>\build\default\openvr.node
 → <my_project_root>\compiled\16.1.0\win32\ia32\openvr.node
 → <my_project_root>\addon-build\release\install-root\openvr.node
 → <my_project_root>\addon-build\debug\install-root\openvr.node
 → <my_project_root>\addon-build\default\install-root\openvr.node
 → <my_project_root>\lib\binding\node-v93-win32-ia32\openvr.node
    at bindings (<my_project_root>\index.js:893:9)
    at Object../node_modules/openvr.js/index.js (<my_project_root>\index.js:6255:88)

Looking at my node_modules folder, I do have <my_project_root>\node_modules\openvr.js\build\Release\openvr.node (and openvr_api.dll, both dated 1985 for some reason), but it appears that on my system it is basing its search on locations in <my_project_root> rather than <my_project_root>\node_modules\openvr.js\.

(in case it's not clear, where I've put <my_project_root> it is actually printing the full absolute path to the root of the project on c: - I haven't tried running on a non-Windows OS, or a non-VR system)

I am running npm 7.11.2, node v16.1.0. I suspect the other machine is probably on an older / different version - we don't have a mechanism in place for synching that.

It seems that on the other machine, these files had actually been manually copied to a place where they could be found.

However, on my machine, doing that just results in another error Error: \\?\C:\code\project\build\openvr.node is not a valid Win32 application.

Aww.. I'm going to make binding module to source-only. It will be fixed by next week.

Ok, thanks for the quick response.

It was fixed maybe. Can you check it?

That does seem to fix the initial issue, although I again have the new problem of openvr.node is not a valid Win32 application.

Actually, bear with me - I'm not convinced I was running the latest version...

I get a similar set of link errors either when installing the latest version from npm, or running npm install in my fork:

openvr.obj : error LNK2001: unresolved external symbol __imp__VR_InitInternal2 [C:\code\temp\openvr.js\build\openvr.vcxproj]
openvr.obj : error LNK2001: unresolved external symbol __imp__VR_GetInitToken [C:\code\temp\openvr.js\build\openvr.vcxproj]
openvr.obj : error LNK2001: unresolved external symbol __imp__VR_GetRuntimePath [C:\code\temp\openvr.js\build\openvr.vcxproj]
openvr.obj : error LNK2001: unresolved external symbol __imp__VR_IsInterfaceVersionValid [C:\code\temp\openvr.js\build\openvr.vcxproj]
openvr.obj : error LNK2001: unresolved external symbol __imp__VR_IsRuntimeInstalled [C:\code\temp\openvr.js\build\openvr.vcxproj]
openvr.obj : error LNK2001: unresolved external symbol __imp__VR_IsHmdPresent [C:\code\temp\openvr.js\build\openvr.vcxproj]
openvr.obj : error LNK2001: unresolved external symbol __imp__VR_GetVRInitErrorAsSymbol [C:\code\temp\openvr.js\build\openvr.vcxproj]
openvr.obj : error LNK2001: unresolved external symbol __imp__VR_GetGenericInterface [C:\code\temp\openvr.js\build\openvr.vcxproj]
openvr.obj : error LNK2001: unresolved external symbol __imp__VR_ShutdownInternal [C:\code\temp\openvr.js\build\openvr.vcxproj]
openvr.obj : error LNK2001: unresolved external symbol __imp__VR_GetVRInitErrorAsEnglishDescription [C:\code\temp\openvr.js\build\openvr.vcxproj]
C:\code\temp\openvr.js\build\Release\openvr.node : fatal error LNK1120: 10 unresolved externals [C:\code\temp\openvr.js\build\openvr.vcxproj]

When I initially got errors doing npm install openvr.js@latest, I tried deleting node_modules and running npm install again, which lead to no error messages during install, but the runtime error openvr.node is not a valid Win32 application.

Can I see sample code?

I think I needed to update Node.