better-sqlite3 icon indicating copy to clipboard operation
better-sqlite3 copied to clipboard

ERROR Cannot start nuxt: Could not locate the bindings file. Tried:

Open dhj-l opened this issue 10 months ago • 7 comments

ERROR Cannot start nuxt: Could not locate the bindings file. Tried: nuxi 16:12:40 → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\build\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\build\Debug\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\build\Release\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\out\Debug\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\Debug\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\out\Release\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\Release\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\build\default\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\compiled\18.20.6\win32\x64\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\addon-build\release\install-root\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\addon-build\debug\install-root\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\addon-build\default\install-root\better_sqlite3.node → C:\Users\dhj\Desktop\nuxt\digitmasterai-ui\node_modules.pnpm\[email protected]\node_modules\better-sqlite3\lib\binding\node-v108-win32-x64\better_sqlite3.node

→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\build\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\build\Debug\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\build\Release\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\out\Debug\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\Debug\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\out\Release\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\Release\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\build\default\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\compiled\18.20.6\win32\x64\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\addon-build\release\install-root\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\addon-build\debug\install-root\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\addon-build\default\install-root\better_sqlite3.node
→ node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\lib\binding\node-v108-win32-x64\better_sqlite3.node
at bindings (node_modules\.pnpm\[email protected]\node_modules\bindings\bindings.js:126:9)
at new Database (node_modules\.pnpm\[email protected]\node_modules\better-sqlite3\lib\database.js:48:64)
at getDB (/C:/Users/dhj/Desktop/nuxt/digitmasterai-ui/node_modules/.pnpm/[email protected][email protected]/node_modules/db0/connectors/better-sqlite3.mjs:19:11)
at Object.exec (/C:/Users/dhj/Desktop/nuxt/digitmasterai-ui/node_modules/.pnpm/[email protected][email protected]/node_modules/db0/connectors/better-sqlite3.mjs:27:14)
at getLocalDatabase (/C:/Users/dhj/Desktop/nuxt/digitmasterai-ui/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nuxt/content/dist/module.mjs:341:12)
at async processCollectionItems (/C:/Users/dhj/Desktop/nuxt/digitmasterai-ui/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nuxt/content/dist/module.mjs:2377:14)
at async /C:/Users/dhj/Desktop/nuxt/digitmasterai-ui/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nuxt/content/dist/module.mjs:2353:20
at async initNuxt (/C:/Users/dhj/Desktop/nuxt/digitmasterai-ui/node_modules/.pnpm/[email protected]_@parcel+watcher_e88361ecebb4ae245a805e9e2e84bd3c/node_modules/nuxt/dist/shared/nuxt.CrJjphBv.mjs:5343:3)
at async NuxtDevServer._load (/C:/Users/dhj/Desktop/nuxt/digitmasterai-ui/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/cli/dist/chunks/dev2.mjs:161:5)
at async NuxtDevServer.load (/C:/Users/dhj/Desktop/nuxt/digitmasterai-ui/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/cli/dist/chunks/dev2.mjs:93:7)

请问这种情况该怎么解决?

dhj-l avatar Feb 17 '25 08:02 dhj-l

When using pnpm as a package manager, ensure that node-gyp is installed globally. Otherwise, try npm or yarn instead.

Google translated: 使用 pnpm 作为包管理器时,请确保全局安装 node-gyp。否则,请尝试使用 npm 或yarn

neoxpert avatar Feb 17 '25 12:02 neoxpert

I was also pwned by this, which was the first major change described in pnpm v10. Postinstall scripts for dependencies are ignored by default. You can pnpm approve-builds to run after installation. nuxt/nuxt#3104

isboyjc avatar Mar 03 '25 22:03 isboyjc

I tried to run the pnpm rebuild and it works.

alizufan avatar Apr 14 '25 15:04 alizufan

This worked as a fix for my application. pnpm approve-builds and then select better-sqlite3 from the list.

I believe you are using pnpm@10. In pnpm@10, there is a breaking/security change that prevents package scripts from being executed. Run pnpm approve-builds and choose better-sqlite3 to allow the execution. (If it didn't work on first time, some times you need to run twice or remove node_modules first)

Originally posted by @farnabaz in #3249

RaymondHolm26 avatar May 25 '25 15:05 RaymondHolm26

Thanks for sharing this solution! I think this belongs in the README or at least in the docs directory (a pr would be great!)

This worked as a fix for my application. pnpm approve-builds and then select better-sqlite3 from the list.

I believe you are using pnpm@10. In pnpm@10, there is a breaking/security change that prevents package scripts from being executed. Run pnpm approve-builds and choose better-sqlite3 to allow the execution. (If it didn't work on first time, some times you need to run twice or remove node_modules first)

Originally posted by @farnabaz in #3249

mceachen avatar May 25 '25 16:05 mceachen

This worked as a fix for my application. pnpm approve-builds and then select better-sqlite3 from the list.

I believe you are using pnpm@10. In pnpm@10, there is a breaking/security change that prevents package scripts from being executed. Run pnpm approve-builds and choose better-sqlite3 to allow the execution. (If it didn't work on first time, some times you need to run twice or remove node_modules first)

Originally posted by @farnabaz in #3249

Thanks a lot. That helped me

devonik avatar May 27 '25 19:05 devonik

I ran pnpm approve-builds and the output told me that I had no packages to approve. I ran pnpm rebuild then ran pnpm approve-builds and was able to get a list of packages to approve. Following the advice posted by @farnabaz, I selected better-sqlite3 and that solved my problem.

KylerJohnsonDev avatar May 31 '25 00:05 KylerJohnsonDev

If you still run into issues after doing the above you might have accidentally added the module to the ignore list. checkout the pnpm-workspace.yaml and move - better-sqlite3 from the ignoredBuiltDependencies to the onlyBuiltDependencies list

yuridesnaijer avatar Jun 23 '25 18:06 yuridesnaijer

If you still run into issues after doing the above you might have accidentally added the module to the ignore list. checkout the pnpm-workspace.yaml and move - better-sqlite3 from the ignoredBuiltDependencies to the onlyBuiltDependencies list

Bro you deserve an award

chendjou237 avatar Jul 03 '25 12:07 chendjou237

修改一下你的 .npmrc

shamefully-hoist=true
strict-peer-dependencies=false
shell-emulator=true
auto-install-peers=false

然后重新下载依赖

Ena-Heleneto avatar Jul 17 '25 04:07 Ena-Heleneto