Specify node version for building pack in coda server

Hello, I am writing a pack to sync some of my data from a directus instance, and I see that directus sdk only seems to support node 18+ (18.20.4), I had the problem my self when developing locally (getting an error internally in the directus lib when creating a directus instance), and solved it using nvm to specify using node 18.20.4, but I’m not sure how I can tell coda to build the pack using the supported node version? :person_cartwheeling::blush:

Thank you for any ideas and help! :muscle::blush:

Hi @Petter_Emil_Anderssen - The relationship between Packs and Node is a little strange, but essentially:

  • Packs run on a custom JavaScript runtime that supports the ECMAScript standard and a few extra libraries that are bolted on. It is not a Node runtime.
  • When developing a Pack locally, Node can be used to run the code locally for testing.
  • When developing a Pack locally, the Coda CLI (which runs in Node) is used to compile the source files into a single bundle.

I’m not entirely sure at which stage you were running into the issue, but the short answer to your question is that you can’t tell Coda to build or run your Pack with a specific Node version, because it doesn’t build your Pack (you build it locally) and it doesn’t run on Node. The version of Node used to build and run it locally is determined by the version of Node you have installed.

It is the case that many NPM libraries are not compatible with the Packs runtime, specifically because they are looking for Node features that aren’t available. You can read more about compatibility here:

Ah, I see!
Thank you so much for taking the time to explain this to me :muscle:

1 Like