osrm-backend icon indicating copy to clipboard operation
osrm-backend copied to clipboard

Fix error: Cannot find module './binding/node_osrm.node'

Open PierreLouisLetoquart opened this issue 1 month ago • 1 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @project-osrm/[email protected] for the project I'm working on.

The bindings for node are now in the binding_napi_v8 folder, but the var OSRM exported request the old folder path.

Here is the diff that solved my problem:

diff --git a/node_modules/@project-osrm/osrm/lib/index.js b/node_modules/@project-osrm/osrm/lib/index.js
index 20aa78f..d9eb5d0 100644
--- a/node_modules/@project-osrm/osrm/lib/index.js
+++ b/node_modules/@project-osrm/osrm/lib/index.js
@@ -1,2 +1,2 @@
-var OSRM = module.exports = require('./binding/node_osrm.node').OSRM;
+var OSRM = module.exports = require('./binding_napi_v8/node_osrm.node').OSRM;
 OSRM.version = require('../package.json').version;

This issue body was partially generated by patch-package.

PierreLouisLetoquart avatar Nov 12 '25 15:11 PierreLouisLetoquart

Thanks for the report! I have found the root cause (there is more than just adapting the path in lib/index.js) and will submit a fix around 20-21 Nov, please wait for me

afarber avatar Nov 16 '25 10:11 afarber