Closed einarpersson closed 1 year ago
same on macos 13.4.1, bun 1.0.0
when i install with npm, the node_sqlite3.node
file is present
$ node -v
v18.16.0
$ npm -v
9.5.1
$ npm i sqlite3
installing with bun doesn't download the compiled node addon
$ bun add sqlite3
Got the same issue. The workaround is to add the package to trustedDependencies in package.json
.
@tanerijun hmm if i init a new project with bun and add "sqlite3"
to the trusted deps array and then install, it still doesn't fetch the .node addon
$ mkdir test
$ cd test
$ bun init -y
# add "sqlite3" to trustedDependencies
$ bun add sqlite3
$ tree node_modules/sqlite3
node_modules/sqlite3
├── LICENSE
├── README.md
├── binding.gyp
├── deps
│ ├── common-sqlite.gypi
│ ├── extract.js
│ ├── sqlite-autoconf-3410100.tar.gz
│ └── sqlite3.gyp
├── lib
│ ├── sqlite3-binding.js
│ ├── sqlite3.d.ts
│ ├── sqlite3.js
│ └── trace.js
├── package.json
└── src
├── async.h
├── backup.cc
├── backup.h
├── database.cc
├── database.h
├── gcc-preinclude.h
├── macros.h
├── node_sqlite3.cc
├── statement.cc
├── statement.h
└── threading.h
I just double checked to be sure, and it's indeed working with trustedDependencies. Here is what I did:
mkdir test-bun
cd test-bun
npm init -y
Edit package.json
to look like this:
{
"name": "test-bun",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"sqlite3": "^5.1.6"
},
"trustedDependencies": [
"sqlite3"
]
}
Then install using bun
bun i
Here is the terminal log:
bun add v1.0.0 (822a00c4)
installed sqlite3@5.1.6
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.11
node-pre-gyp info using node@18.16.0 | darwin | arm64
node-pre-gyp info check checked for "/Users/tvince/Projects/test-bun/node_modules/sqlite3/lib/binding/napi-v6-darwin-unknown-arm64/node_sqlite3.node" (not found)
node-pre-gyp http GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-darwin-unknown-arm64.tar.gz
node-pre-gyp info install unpacking napi-v6-darwin-unknown-arm64/node_sqlite3.node
node-pre-gyp info extracted file count: 1
[sqlite3] Success: "/Users/tvince/Projects/test-bun/node_modules/sqlite3/lib/binding/napi-v6-darwin-unknown-arm64/node_sqlite3.node" is installed via remote
node-pre-gyp info ok
105 packages installed [2.41s]
For anyone struggling with getting the postinstall to run for a transitive dependency, delete both node_modules
and bun.lockb
, make sure the package is in dependencies and trustedDependencies, and then do a bun install.
Just wanna share that I have this issue too. My sqlite3 runs fine in my MacOS Venture M1 but when ported to Ubuntu 20.04, it encounters this issue. Thanks @tanerijun and @ineffyble for the tips.
What works for me:
...
1. add trustedDependencies for sqlite3 in package.json
"dependencies": {
"sqlite3": "^5.1.6"
},
"trustedDependencies": [
"sqlite3"
]
...
2. Remove node_modules: rm -rf node_modules
3. Fresh install: npm i
Duplicate of #4959
What version of Bun is running?
1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983
What platform is your computer?
Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
Run
bunx pocketbase-typegen
(orbunx --bun pocketbase-typegen
)What is the expected behavior?
I expect that the typegenerator will run and output the same as
npx pocketbase-typegen
which in case there is no database running will beWhat do you see instead?
or
Additional information
No response