node-adodb
node-adodb copied to clipboard
ERR_INVALID_ARG_TYPE
I'm trying to use this module in Electron with Vue. The module works well outside this setup. But during development using the webpack dev server, as soon as I require the module I receive this error:
Uncaught TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:107)
at Object.join (path.js:372)
at eval (engine.js?72d2:16)
at Object../node_modules/node-adodb/lib/engine.js (chunk-vendors.js:7791)
at __webpack_require__ (app.js:785)
at fn (app.js:151)
at eval (index.js?d1a5:11)
at Object../node_modules/node-adodb/index.js (chunk-vendors.js:7768)
at __webpack_require__ (app.js:785)
at fn (app.js:151)
Thanks.
This happens because the environment variables pointing to the windows dir / sysroot are undefined using Vue CLI:
https://github.com/nuintun/node-adodb/blob/166feff849ded17e50745183ef08733ec7a9f00e/lib/engine.js#L15
Not sure if this happens in dev mode only.
More on the topic: https://cli.vuejs.org/guide/mode-and-env.html#environment-variables
I fixed this by hardcoding the path:
https://github.com/jvolker/node-adodb/blob/6a69b4fcd89e6b68e4018a0880ecabf994f332ac/lib/engine.js#L15