-
Notifications
You must be signed in to change notification settings - Fork 104
VS Code extension support for pnpm installed postgrestools #377
-
The VS Code extension, upon startup, copies the postgrestools binary to a temporary location, and executes it from there. This is to prevent locking the file on the user's system while the VS Code extension is running.
✅ This works if the binary were installed via curl
, since it downloads a standalone executable file.
✅ It also works if the binary were installed via npm
, another recommended installation method.
❌ However, if the binary were installed via pnpm
, copying the binary causes it to fail to execute from its new location.
The error we see is the following:
node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module '~/Library/Application Support/Code/User/globalStorage/supabase.postgrestools/tmp-bin/global/5/.pnpm/@postgrestools+postgrestools@0.6.1/node_modules/@postgrestools/postgrestools/bin/postgrestools'
at Function._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Function._load (node:internal/modules/cjs/loader:1055:27)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
at node:internal/main/run_main_module:36:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v22.14.0
We might be able to use pnpm link, although it would make the exit cleanup more involved since we'd have to remove the local node_modules
folder.
Another solution would be to copy the executable to the same directory in which we found it, just with a new name. A new name is being used already, so this would be a pretty minimal change. We'd want to fail of course if such a file already exists.
I'm taking a look at this now - may open an MR tonight. Cheers!
Beta Was this translation helpful? Give feedback.