@@ -13,6 +13,8 @@ const path = require('path');
1313
1414let native = null ;
1515let nativeError = null ;
16+ let npmError = null ;
17+ let localError = null ;
1618let initialized = false ;
1719let loadedFrom = null ;
1820
@@ -29,6 +31,7 @@ function loadNative() {
2931 loadedFrom = 'npm' ;
3032 return ;
3133 } catch ( e ) {
34+ npmError = e ;
3235 // Not installed via npm, try local
3336 }
3437
@@ -38,6 +41,7 @@ function loadNative() {
3841 native = require ( nativePath ) ;
3942 loadedFrom = 'local' ;
4043 } catch ( e ) {
44+ localError = e ;
4145 nativeError = e ;
4246 }
4347}
@@ -72,7 +76,9 @@ function get() {
7276 `OpenContext native bindings not available.\n` +
7377 ` If installed via npm: try reinstalling the package\n` +
7478 ` If developing locally: cd crates/opencontext-node && npm run build\n` +
75- `Error: ${ nativeError ?. message || 'unknown' } `
79+ ` If optional deps were skipped: npm install -g @aicontextlab/cli --include=optional\n` +
80+ `Error (npm): ${ npmError ?. message || 'unknown' } \n` +
81+ `Error (local): ${ localError ?. message || 'unknown' } `
7682 ) ;
7783 }
7884 return native ;
@@ -88,7 +94,9 @@ function require_() {
8894 `OpenContext native bindings not available.\n` +
8995 ` If installed via npm: try reinstalling the package\n` +
9096 ` If developing locally: cd crates/opencontext-node && npm run build\n` +
91- `Error: ${ nativeError ?. message || 'unknown' } `
97+ ` If optional deps were skipped: npm install -g @aicontextlab/cli --include=optional\n` +
98+ `Error (npm): ${ npmError ?. message || 'unknown' } \n` +
99+ `Error (local): ${ localError ?. message || 'unknown' } `
92100 ) ;
93101 }
94102}
0 commit comments