Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM support did not resolve the node dependencies (knex, better-sqlite3) #15717

Open
vanpipy opened this issue Sep 1, 2022 · 13 comments · Fixed by #13633 or #24727
Open

NPM support did not resolve the node dependencies (knex, better-sqlite3) #15717

vanpipy opened this issue Sep 1, 2022 · 13 comments · Fixed by #13633 or #24727
Labels
bug Something isn't working correctly node compat

Comments

@vanpipy
Copy link

vanpipy commented Sep 1, 2022

Env

  • Deno version:
deno 1.25.0 (release, x86_64-unknown-linux-gnu)
v8 10.6.194.5
typescript 4.7.4

Phenomenon

Run the code:

import knex from 'npm:knex';

const DB = knex({
  client: 'better-sqlite3',
  connection: {
    filename: './localdb.sqlite3'
  }
});

export default DB

And throw exception:

error: Uncaught (in promise) Error: Cannot find module 'events'
Require stack:
- /home/leroy/.cache/deno/npm/registry.npmjs.org/tarn/3.0.2/dist/Pool.js
- /home/leroy/.cache/deno/npm/registry.npmjs.org/tarn/3.0.2/dist/tarn.js
- /home/leroy/.cache/deno/npm/registry.npmjs.org/knex/2.3.0/lib/client.js
- /home/leroy/.cache/deno/npm/registry.npmjs.org/knex/2.3.0/lib/knex-builder/Knex.js
- /home/leroy/.cache/deno/npm/registry.npmjs.org/knex/2.3.0/lib/index.js
- /home/leroy/.cache/deno/npm/registry.npmjs.org/knex/2.3.0/knex.js
- /home/leroy/.cache/deno/npm/registry.npmjs.org/knex/2.3.0/knex.js
    at Function.Module._resolveFilename (deno:ext/node/02_require.js:609:17)
    at Function.Module._load (deno:ext/node/02_require.js:441:29)
    at Module.require (deno:ext/node/02_require.js:652:21)
    at require (deno:ext/node/02_require.js:777:18)
    at Object.<anonymous> (file:///home/leroy/.cache/deno/npm/registry.npmjs.org/tarn/3.0.2/dist/Pool.js:6:18)
    at Object.<anonymous> (file:///home/leroy/.cache/deno/npm/registry.npmjs.org/tarn/3.0.2/dist/Pool.js:518:4)
    at Module._compile (deno:ext/node/02_require.js:713:36)
    at Object.Module._extensions..js (deno:ext/node/02_require.js:740:12)
    at Module.load (deno:ext/node/02_require.js:630:34)
    at Function.Module._load (deno:ext/node/02_require.js:487:14)

Then find the keyword in the tarn package:

$ grep -r 'events' ~/.cache/deno/npm/registry.npmjs.org/tarn/3.0.2
/home/leroy/.cache/deno/npm/registry.npmjs.org/tarn/3.0.2/dist/Pool.d.ts: import { EventEmitter } from 'events';
/home/leroy/.cache/deno/npm/registry.npmjs.org/tarn/3.0.2/dist/Pool.js: const events_1 = require("events");
/home/leroy/.cache/deno/npm/registry.npmjs.org/tarn/3.0.2/dist/Pool.js: this.emitter = new events_1.EventEmitter();

Expected

Resolve the node dependencies.

@kitsonk kitsonk added bug Something isn't working correctly node compat labels Sep 1, 2022
@kitsonk kitsonk changed the title Experimental npm support did not resolve the node dependencie Experimental npm support did not resolve the node dependencies Sep 1, 2022
@bartlomieju
Copy link
Member

I get a completely different error on latest main:

Download https://registry.npmjs.org/is-core-module
Download https://registry.npmjs.org/has
Download https://registry.npmjs.org/function-bind
Download https://registry.npmjs.org/has/-/has-1.0.3.tgz
Download https://registry.npmjs.org/ms/-/ms-2.1.2.tgz
Download https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz
Download https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.5.0.tgz
Download https://registry.npmjs.org/commander/-/commander-9.4.0.tgz
Download https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz
Download https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz
Download https://registry.npmjs.org/tarn/-/tarn-3.0.2.tgz
Download https://registry.npmjs.org/getopts/-/getopts-2.3.0.tgz
Download https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz
Download https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz
Download https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz
Download https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz
Download https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz
Download https://registry.npmjs.org/knex/-/knex-2.3.0.tgz
Download https://registry.npmjs.org/esm/-/esm-3.2.25.tgz
Download https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz
Download https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz
Download https://registry.npmjs.org/tildify/-/tildify-2.0.0.tgz
Download https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz
Download https://registry.npmjs.org/debug/-/debug-4.3.4.tgz
Download https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz
Knex: run
$ npm install better-sqlite3 --save
Cannot find module 'better-sqlite3'
Require stack:
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/dialects/better-sqlite3/index.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/dialects/index.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/knex-builder/internal/config-resolver.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/knex-builder/Knex.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/index.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/knex.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/knex.js
Error: Cannot find module 'better-sqlite3'
Require stack:
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/dialects/better-sqlite3/index.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/dialects/index.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/knex-builder/internal/config-resolver.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/knex-builder/Knex.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/index.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/knex.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/knex.js
    at Function.Module._resolveFilename (deno:ext/node/02_require.js:609:17)
    at Function.Module._load (deno:ext/node/02_require.js:441:29)
    at Module.require (deno:ext/node/02_require.js:652:21)
    at require (deno:ext/node/02_require.js:782:18)
    at Client_BetterSQLite3._driver (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/dialects/better-sqlite3/index.js:7:12)
    at Client_BetterSQLite3.initializeDriver (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/client.js:190:26)
    at new Client (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/client.js:75:12)
    at new Client_SQLite3 (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/dialects/sqlite3/index.js:22:5)
    at new Client_BetterSQLite3 (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/dialects/better-sqlite3/index.js:5:1)
    at knex (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/knex-builder/Knex.js:16:28)
error: Uncaught Error: Knex: run
$ npm install better-sqlite3 --save
Cannot find module 'better-sqlite3'
Require stack:
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/dialects/better-sqlite3/index.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/dialects/index.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/knex-builder/internal/config-resolver.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/knex-builder/Knex.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/index.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/knex.js
- /Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/knex.js
    at Client_BetterSQLite3.initializeDriver (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/client.js:194:13)
    at new Client (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/client.js:75:12)
    at new Client_SQLite3 (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/dialects/sqlite3/index.js:22:5)
    at new Client_BetterSQLite3 (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/dialects/better-sqlite3/index.js:5:1)
    at knex (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/knex/2.3.0/lib/knex-builder/Knex.js:16:28)
    at file:///Users/ib/dev/deno/foo.js:3:12

I assume the root cause has already been fixed and will be released in v1.25.1 tonight, but we need need to address problem with sqlite

@vanpipy
Copy link
Author

vanpipy commented Sep 1, 2022

That is great! Thanks for your work a lot!

@kt3k
Copy link
Member

kt3k commented Sep 14, 2022

If I add import "npm:better-sqlite3"; at the top of the script, I see further different error.

$ deno run -A --unstable a.js
sqlite does not support inserting default values. Set the `useNullAsDefault` flag to hide this warning. (see docs https://knexjs.org/guide/query-builder.html#insert).
Error: Could not locate the bindings file. Tried:
 → /Users/kt3k/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/build/better_sqlite3.node
 → /Users/kt3k/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/build/Debug/better_sqlite3.node
 → /Users/kt3k/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/build/Release/better_sqlite3.node
 → /Users/kt3k/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/out/Debug/better_sqlite3.node
 → /Users/kt3k/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/Debug/better_sqlite3.node
 → /Users/kt3k/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/out/Release/better_sqlite3.node
...

better-sqlite3 seems depending on Node API. I think this issue is blocked by #13633

@kt3k kt3k changed the title Experimental npm support did not resolve the node dependencies Experimental npm support did not resolve the node dependencies (knex, better-sqlite3) Sep 14, 2022
@bartlomieju
Copy link
Member

Just tried with #13633 and it appears to resolve this issue.

@andykais
Copy link

andykais commented Jan 24, 2023

I just tried this with deno 1.29.4 and it does not appear to be resolved.

import Database from 'npm:better-sqlite3'
const db = new Database(':memory:')

deno run --unstable -A repro.ts

error: Uncaught Error: Could not locate the bindings file. Tried:
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/build/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/build/Debug/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/build/Release/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/out/Debug/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/Debug/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/out/Release/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/Release/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/build/default/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/compiled/18.12.1/darwin/arm64/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/addon-build/release/install-root/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/addon-build/debug/install-root/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/addon-build/default/install-root/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/lib/binding/node-v108-darwin-arm64/better_sqlite3.node
    at bindings (file:///Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/bindings.js:126:9)
    at new Database (file:///Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/8.0.1/lib/database.js:48:64)
    at file:///Users/andrew/Code/scratchwork/deno.ts:3:12

I have tried this on both an M1 mac and linux. Listing the files inside that bindings folder, I see this:

ls -l /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/
-rw-r--r-- 1 andrew staff 1.1K Oct 26  1985 LICENSE.md
-rw-r--r-- 1 andrew staff 3.4K Oct 26  1985 README.md
-rw-r--r-- 1 andrew staff 5.9K Oct 26  1985 bindings.js
-rw-r--r-- 1 andrew staff  660 Oct 26  1985 package.json

@bartlomieju bartlomieju reopened this Jan 24, 2023
@andykais
Copy link

Just another update (mostly to keep the git bot from marking this stale 😅). This appears to still be broken in deno 1.30.0

@andykais
Copy link

andykais commented Feb 1, 2023

adding another to the mix, an asynchronous sqlite library https://www.npmjs.com/package/sqlite3 (which the readme specifies uses node-pre-gyp to download prebuilt binaries)

error: Uncaught Error: Cannot find module '/Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/sqlite3/5.1.4/lib/binding/napi-v6-darwin-unknown-arm64/node_sqlite3.node'
Require stack:
- /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/sqlite3/5.1.4/lib/sqlite3-binding.js
- /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/sqlite3/5.1.4/lib/sqlite3.js
- /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/sqlite3/5.1.4/lib/sqlite3.js
    at Function.Module._resolveFilename (deno:ext/node/02_require.js:637:17)
    at Function.Module._load (deno:ext/node/02_require.js:469:29)
    at Module.require (deno:ext/node/02_require.js:680:21)
    at require (deno:ext/node/02_require.js:820:18)
    at Object.<anonymous> (file:///Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/sqlite3/5.1.4/lib/sqlite3-binding.js:4:17)
    at Object.<anonymous> (file:///Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/sqlite3/5.1.4/lib/sqlite3-binding.js:7:4)
    at Module._compile (deno:ext/node/02_require.js:747:36)
    at Object.Module._extensions..js (deno:ext/node/02_require.js:780:12)
    at Module.load (deno:ext/node/02_require.js:658:34)
    at Function.Module._load (deno:ext/node/02_require.js:515:14)

I dont personally need this library for any projects, but I discovered this while attempting to compile a few benchmarks. Similarly, the folder which it expects to contain the binary is empty:

l /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/sqlite3/5.1.4/lib/
total 24K
-rw-r--r-- 1 andrew.kaiser staff  241 Oct 26  1985 sqlite3-binding.js
-rw-r--r-- 1 andrew.kaiser staff 7.0K Oct 26  1985 sqlite3.d.ts
-rw-r--r-- 1 andrew.kaiser staff 6.3K Oct 26  1985 sqlite3.js
-rw-r--r-- 1 andrew.kaiser staff 1.4K Oct 26  1985 trace.js

@andykais
Copy link

andykais commented Mar 3, 2023

this still appears to be broken in deno v1.31. Adding this comment because the 1.31 blog post points out a stabilization of the Node-API, which better-sqlite3 seems to be built off of https://deno.com/blog/v1.31#stabilization-of-node-api. I think this is perhaps because deno attempts to download only the files that are part of the dependency tree, or defined in the package.json file. On the other hand, I believe npm just downloads everything in the published tarball. This is the contents of the package.json

{
  "name": "bindings",
  "description": "Helper module for loading your native module's .node file",
  "keywords": [
    "native",
    "addon",
    "bindings",
    "gyp",
    "waf",
    "c",
    "c++"
  ],
  "version": "1.5.0",
  "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)",
  "repository": {
    "type": "git",
    "url": "git://github.com/TooTallNate/node-bindings.git"
  },
  "main": "./bindings.js",
  "bugs": {
    "url": "https://github.com/TooTallNate/node-bindings/issues"
  },
  "homepage": "https://github.com/TooTallNate/node-bindings",
  "license": "MIT",
  "dependencies": {
    "file-uri-to-path": "1.0.0"
  }
}
ls -l /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/
-rw-r--r-- 1 andrew staff 1.1K Oct 26  1985 LICENSE.md
-rw-r--r-- 1 andrew staff 3.4K Oct 26  1985 README.md
-rw-r--r-- 1 andrew staff 5.9K Oct 26  1985 bindings.js
-rw-r--r-- 1 andrew staff  660 Oct 26  1985 package.json

@andykais
Copy link

another native library failed. This one is https://github.com/cocktailpeanut/dalai (https://www.npmjs.com/package/dalai), which was a recent share on HN that runs facebook's llama.cpp language model natively. The error is below:
deno run npm:dalai llama

innerError Error: Cannot find module '../build/Debug/pty.node'
Require stack:
- /home/andrew/.cache/deno/npm/registry.npmjs.org/node-pty/0.10.1/lib/unixTerminal.js
- /home/andrew/.cache/deno/npm/registry.npmjs.org/node-pty/0.10.1/lib/index.js
- /home/andrew/.cache/deno/npm/registry.npmjs.org/dalai/0.1.0/index.js
- /home/andrew/.cache/deno/npm/registry.npmjs.org/dalai/0.1.0/bin/cli.js
    at Function.Module._resolveFilename (ext:deno_node_loading/02_require.js:635:15)
    at Function.Module._load (ext:deno_node_loading/02_require.js:467:27)
    at Module.require (ext:deno_node_loading/02_require.js:678:19)
    at require (ext:deno_node_loading/02_require.js:818:16)
    at Object.<anonymous> (file:///home/andrew/.cache/deno/npm/registry.npmjs.org/node-pty/0.10.1/lib/unixTerminal.js:30:15)
    at Object.<anonymous> (file:///home/andrew/.cache/deno/npm/registry.npmjs.org/node-pty/0.10.1/lib/unixTerminal.js:278:4)
    at Module._compile (ext:deno_node_loading/02_require.js:745:34)
    at Object.Module._extensions..js (ext:deno_node_loading/02_require.js:778:10)
    at Module.load (ext:deno_node_loading/02_require.js:656:32)
    at Function.Module._load (ext:deno_node_loading/02_require.js:513:12)
error: Uncaught Error: Cannot find module '../build/Release/pty.node'
Require stack:
- /home/andrew/.cache/deno/npm/registry.npmjs.org/node-pty/0.10.1/lib/unixTerminal.js
- /home/andrew/.cache/deno/npm/registry.npmjs.org/node-pty/0.10.1/lib/index.js
- /home/andrew/.cache/deno/npm/registry.npmjs.org/dalai/0.1.0/index.js
- /home/andrew/.cache/deno/npm/registry.npmjs.org/dalai/0.1.0/bin/cli.js
    at Function.Module._resolveFilename (ext:deno_node_loading/02_require.js:635:15)
    at Function.Module._load (ext:deno_node_loading/02_require.js:467:27)
    at Module.require (ext:deno_node_loading/02_require.js:678:19)
    at require (ext:deno_node_loading/02_require.js:818:16)
    at Object.<anonymous> (file:///home/andrew/.cache/deno/npm/registry.npmjs.org/node-pty/0.10.1/lib/unixTerminal.js:26:11)
    at Object.<anonymous> (file:///home/andrew/.cache/deno/npm/registry.npmjs.org/node-pty/0.10.1/lib/unixTerminal.js:278:4)
    at Module._compile (ext:deno_node_loading/02_require.js:745:34)
    at Object.Module._extensions..js (ext:deno_node_loading/02_require.js:778:10)
    at Module.load (ext:deno_node_loading/02_require.js:656:32)
    at Function.Module._load (ext:deno_node_loading/02_require.js:513:12)

deno --version

deno 1.31.2 (release, x86_64-unknown-linux-gnu)
v8 11.0.226.19
typescript 4.9.4

tested on linux, also npx dalai llama does succeed

@loynoir
Copy link

loynoir commented May 22, 2023

@kt3k

better-sqlite3 seems depending on Node API. I think this issue is blocked by #13633

I think it is blocked by #19130

Expect to search under /home/vscode/.cache/deno/npm/private-npm/napi-example/1.0.0.

But actually search under /home/vscode/.cache/deno/npm/private-npm/bindings/1.5.0

@andykais
Copy link

This is still a problem in deno 1.36.4. It appears that Bun 1.0 now supports better-sqlite3

WiseLibs/better-sqlite3#1034 (comment)

We are moving to bun 1.0, it appears to work

@bkerin
Copy link

bkerin commented Jun 20, 2024

It looks to me like this is still a problem in deno 1.44.2

dsherret pushed a commit that referenced this issue Jul 26, 2024
Adds support for `npm:bindings` and `npm:callsites` packages because of
changes in
denoland/deno_core#838.

This `deno_core` bump causes us to stop prepending `file://` scheme for
locations
in stack traces that are for local files.

Fixes #24462 , fixes
#22671 , fixes
#15717 , fixes
#19130 , fixes
WiseLibs/better-sqlite3#1205 , fixes
WiseLibs/better-sqlite3#1034 , fixes
#20936

---------

Co-authored-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
@andykais
Copy link

andykais commented Aug 6, 2024

hmm so I see the pr that closed this issue was part of the 1.45.5 release (sidenote: I found by poking around the Releases on github, it would be ideal if I could link my way from an issue/pr to the deno release that it arrived in. Weirdly, I can see this pr merged as this commit into main here but it doesnt reference where it appears in the 1.45.5 tag commits here

This does not appear to be fixed though on macos.

deno 1.45.5 (release, aarch64-apple-darwin)
v8 12.7.224.13
typescript 5.5.2

This snippet:

import * as sqlite from 'npm:better-sqlite3@11.1.2'
const database = new sqlite.default(':memory:')

gives the following output:

Uncaught Error: Could not locate the bindings file. Tried:
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/build/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/build/Debug/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/build/Release/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/out/Debug/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/Debug/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/out/Release/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/Release/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/build/default/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/compiled/20.11.1/darwin/arm64/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/addon-build/release/install-root/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/addon-build/debug/install-root/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/addon-build/default/install-root/better_sqlite3.node
 → /Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/lib/binding/node-v108-darwin-arm64/better_sqlite3.node
    at bindings (file:///Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/bindings/1.5.0/bindings.js:126:9)
    at new Database (file:///Users/andrew/Library/Caches/deno/npm/registry.npmjs.org/better-sqlite3/11.1.2/lib/database.js:48:64)
    at <anonymous>:1:39

@lucacasonato lucacasonato changed the title Experimental npm support did not resolve the node dependencies (knex, better-sqlite3) NPM support did not resolve the node dependencies (knex, better-sqlite3) Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat
Projects
None yet
8 participants