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

sv create with lucia better-sqlite3. App errors with 'Error: Could not locate the bindings file. #424

Closed
fbehrens opened this issue Jan 25, 2025 · 7 comments · Fixed by #432
Labels
bug Something isn't working pkg:add sv add

Comments

@fbehrens
Copy link
Contributor

fbehrens commented Jan 25, 2025

Hi,
i believe this should be working.
I hope not to be silly and bothering you with stupid mistakes.

But,i am on macos, and here is the problem i report

# myenv
node -v #v22.11.0
pnpm -v # 10.0.0
sqlite3 -version # 3.48.0 2025-01-14 11:05:00 d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010 (64-bit)

pnpm dlx sv create app1
#  Welcome to the Svelte CLI! (v0.6.16)
# │  SvelteKit minimal
# │  Yes, using Typescript syntax
# │  tailwindcss, sveltekit-adapter, drizzle, lucia
# ◇  sveltekit-adapter: node
# ◇  drizzle: Which database would you like to use?: SQLite
# ◇  drizzle: Which SQLite client would you like to use?: better-sqlite3
# ◇  lucia: Do you want to include a demo?:  Yes
# ◇  tailwindcss: Which plugins would you like to add?

cd app1
git init && git add -A && git commit -m "Initial commit"

pnpm run dev --open
pnpm run db:push # get same error

# > [email protected] db:push /Users/fb/Documents/Github/mylucia/app1
# > drizzle-kit push

# No config path provided, using default 'drizzle.config.ts'
# Reading config file '/Users/fb/Documents/Github/mylucia/app1/drizzle.config.ts'
# Error: Could not locate the bindings file. Tried:
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/Release/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/Debug/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/out/Release/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/Release/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/default/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/compiled/22.11.0/darwin/arm64/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node
#  → /Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/lib/binding/node-v127-darwin-arm64/better_sqlite3.node
#     at bindings (/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/bindings/bindings.js:126:9)
#     at new Database (/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/lib/database.js:48:64)
#     at connectToSQLite (/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:64920:24)
#     at async sqlitePush (/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:67969:18)
#     at async Object.handler (/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:76977:9)
#     at async run (/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:76221:7) {
#   tries: [
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/Debug/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/Release/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/out/Debug/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/Debug/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/out/Release/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/Release/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/default/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/compiled/22.11.0/darwin/arm64/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node',
#     '/Users/fb/Documents/Github/mylucia/app1/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/lib/binding/node-v127-darwin-arm64/better_sqlite3.node'
#   ]
# }

pnpm list
# dependencies:
# @node-rs/argon2 2.0.2
# @oslojs/crypto 1.0.1
# @oslojs/encoding 1.1.0
# better-sqlite3 11.8.1
# drizzle-orm 0.38.4

# devDependencies:
# @sveltejs/adapter-node 5.2.12       autoprefixer 10.4.20                tailwindcss 3.4.17
# @sveltejs/kit 2.16.1                drizzle-kit 0.30.2                  typescript 5.7.3
# @sveltejs/vite-plugin-svelte 5.0.3  svelte 5.19.3                       vite 6.0.11
# @types/better-sqlite3 7.6.12        svelte-check 4.1.4

@manuel3108 manuel3108 changed the title 'sv create with lucia better-sqlite3'. App errors with 'Error: Could not locate the bindings file. Tried:.....' sv create with lucia better-sqlite3. App errors with 'Error: Could not locate the bindings file. Jan 31, 2025
@manuel3108
Copy link
Member

@fbehrens Did you provide the exact command output? If so, before running pnpm run dev or pnpm run db:push you should run pnpm install to download all the required dependencies.

Also you ran sqlite3 -version which let's me think that you have installed sqlite locally. As far as I'm aware of this is not actually required.

If you did run pnpm install or are still getting this error after running this command, this would be strange, as I'm unable to reproduce this error locally (on linux though)

@manuel3108 manuel3108 added bug Something isn't working pkg:add sv add labels Jan 31, 2025
@manuel3108
Copy link
Member

@hyunbinseo Just saw your issue in hyunbinseo/svelte-kitty#16 and this looks closely related if not the same issue, as OP is also using pnpm@10.

@fbehrens Could you try adding this to your package.json and run pnpm install again? Does everything works as expected afterwards?

{
  "pnpm": {
    "onlyBuiltDependencies": ["better-sqlite3"]
  }
}

This is similar to one of the pending issues, see #388

@fbehrens
Copy link
Contributor Author

Yes, still gettin the same problem (on my machine), and only when using pnpm.

When I modify package.json as recommended, pnpm install was not enough to fix this.

But rm -rf node_modules does then makes everything as expected.

I leave closing the issue up to you.

Thanks for all this work,
I hope you can stay sane in supporting so much integrations

@manuel3108
Copy link
Member

Thanks for your input. I'm able to reproduce this now!

@manuel3108
Copy link
Member

Would you mind trying out if this fixes the issue you previously had?

pnpx https://pkg.pr.new/sveltejs/cli/sv@432 create

@fbehrens
Copy link
Contributor Author

fbehrens commented Feb 2, 2025

No, I definitely wouldn't mind.

#432 fixes the issue.

I am amazed by by, that you build this infrastructure to make the pull request public available.

Thanks

@manuel3108
Copy link
Member

#432 fixes the issue.

Great, thanks for testing!

I am amazed by by, that you build this infrastructure to make the pull request public available.

Well it's just using a tool and it's quite simple to integrate

- name: publish preview
if: ${{ steps.changed-files.outputs.all_changed_files_count > 0 }}
env:
CHANGED_DIRS: ${{ steps.changed-files.outputs.all_changed_files }}
# run: |
# node scripts/get-deps-to-publish.js
run: pnpm dlx [email protected] publish --pnpm './packages/*'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:add sv add
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants