Using the npm package sqlite-vec in a commonjs project I get:
/Users/achraf/test-sqlite-vec/node_modules/sqlite-vec/index.cjs:42
fileURLToPath(new URL(".", import.meta.url)),
^^^^
SyntaxError: Cannot use 'import.meta' outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:121:18)
at Object.<anonymous> (/Users/achraf/test-sqlite-vec/index.js:2:19)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
Node.js v18.17.1
I was able to fix it by making the following change in index.cjs:
// current
fileURLToPath(new URL(".", import.meta.url)),
// fix
fileURLToPath(new URL(".", `file:${__dirname}/`)),
I can’t find the source for the package so I didn’t open a PR. Thanks!
Using the npm package
sqlite-vec
in a commonjs project I get:I was able to fix it by making the following change in
index.cjs
:I can’t find the source for the package so I didn’t open a PR. Thanks!