osrm-backend
osrm-backend copied to clipboard
OSRM node bindings v6.0.0 fails to load: wrong path to binary in index.js
Issue
When using the OSRM Node bindings v6.0.0, the module fails to load due to an incorrect path reference in lib/index.js.
Specifically, the following line in index.js attempts to load the binary from a path that does not exist:
var OSRM = module.exports = require('./binding/node_osrm.node').OSRM;
However, the binary file is actually located under a different directory:
./binding_napi_v8/node_osrm.node
This causes the following error when trying to require the package
Uncaught Error: Cannot find module './binding/node_osrm.node'
Steps to reproduce
- Install the OSRM Node bindings via npm:
npm install @project-osrm/[email protected]
- In a Node.js script, attempt to require the module:
const OSRM = require('@project-osrm/osrm');
- Run the script:
node script.js
You will encounter the following error:
Error: Cannot find module './binding/node_osrm.node'
- Replace
./binding/node_osrm.nodewith ./binding_napi_v8/node_osrm.nodein lib/index.js to fix the error.
Specifications
- Library version: @project-osrm/[email protected]
- Node.js version: v22.13.0
- Operating system: TUXEDO OS 24.04