`coda validate` doesn't work when `@codahq/packs-sdk` is installed globally

If I install @codahq/packs-sdk globally with npm install --global @codahq/packs-sdk then run coda init and coda validate pack.ts I get the error:

✘ [ERROR] Could not resolve "@codahq/packs-sdk"

    pack.ts:1:22:
      1 │ import * as coda from "@codahq/packs-sdk";
        ╵                       ~~~~~~~~~~~~~~~~~~~

To fix, had to locally install npm install @codahq/packs-sdk and then validate worked.

Wanted to mention this because the docs seem to indicate global install is a good idea:

But for me it doesn’t work.

TBH I’m pretty confused by all of this; I’ve never got it working in a way I can say “coda ...”, I always have to do “npx coda ...

1 Like

Thanks for reporting this @Connor_McCormick1. It looks like there are two issues at play here:

  1. npm install --global only installs the coda command line tool, but not the actual library.
  2. coda init doesn’t add a local dependency on the library to your package.json file, since it assumes it was already installed.

I think #2 there is a bug and something we should fix, and I’ll open a bug with our engineering team.

1 Like

Amazing! Glad it was a useful report

1 Like

Thanks for reporting! This will be fixed in our next release in a week so.

1 Like