sourcegraph / cody

AI that knows your entire codebase
https://cody.dev
Apache License 2.0
2.26k stars 215 forks source link

bug: Error: Cannot find module './keytar-VMICNFEJ.node' #4736

Open wesrice opened 4 days ago

wesrice commented 4 days ago

Version

@sourcegraph/cody-agent@0.1.0

Describe the bug

When trying to use Cody agent, I encounter an error Error: Cannot find module './keytar-VMICNFEJ.node'.

Here is the full trace:

Need to install the following packages:
@sourcegraph/cody-agent@0.1.0
Ok to proceed? (y) y
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
node:internal/modules/cjs/loader:1143
  throw err;
  ^

Error: Cannot find module './keytar-VMICNFEJ.node'
Require stack:
- ~/.npm/_npx/f3e62f8c44d4f6af/node_modules/@sourcegraph/cody-agent/dist/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
    at Module._load (node:internal/modules/cjs/loader:981:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at ../node_modules/.pnpm/keytar@7.9.0/node_modules/keytar/lib/keytar.js (~/.npm/_npx/f3e62f8c44d4f6af/node_modules/@sourcegraph/cody-agent/dist/index.js:93668:19)
    at __require (~/.npm/_npx/f3e62f8c44d4f6af/node_modules/@sourcegraph/cody-agent/dist/index.js:13:50)
    at src/cli/auth/secrets.ts (~/.npm/_npx/f3e62f8c44d4f6af/node_modules/@sourcegraph/cody-agent/dist/index.js:99603:29)
    at __init (~/.npm/_npx/f3e62f8c44d4f6af/node_modules/@sourcegraph/cody-agent/dist/index.js:10:56)
    at src/cli/auth/AuthenticatedAccount.ts (~/.npm/_npx/f3e62f8c44d4f6af/node_modules/@sourcegraph/cody-agent/dist/index.js:99721:5)
    at __init (~/.npm/_npx/f3e62f8c44d4f6af/node_modules/@sourcegraph/cody-agent/dist/index.js:10:56) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '~/.npm/_npx/f3e62f8c44d4f6af/node_modules/@sourcegraph/cody-agent/dist/index.js'
  ]
}

Expected behavior

I expect npx @sourcegraph/cody-agent help to install and show the CLI usage as mentioned in https://github.com/sourcegraph/cody/tree/main/agent#releases.

Additional context

For what it's worth, npx @sourcegraph/cody-agent@0.0.5-b help works as expected.

I'm also generally curious about the usage of the Keytar dependency, considering that it is archived and no longer maintained. There are a few linked PRs in Keytar's farewell issue that show how others are now handling this implementation. It seems like Electron's safeStorage api is a viable option, but it's unclear how this impacts password storage for CLI usage.

See also - https://github.com/microsoft/vscode-discussions/discussions/748