Problem setting up a development Enketo server instance

Hi! I'm working on setting up a development stack for ODK Central, potentially looking at adding an additional endpoint to the Central Backend to allow for getting a pdf from Enketo of a form submission using the attachments the form was originally filled out with, rather than the current form attachments.

I've got dev versions of central-backend and central-frontend up and running without issue, but have been running into problems with setting up a development instance of Enketo. I have followed the instructions laid out in the Enketo Express repo for manual installation (https://github.com/enketo/enketo-express/blob/master/tutorials/00-getting-started.md#manually). npm install completes without problem and redis is running on the default port.

However, on attempting to run Enketo with npm run in the project root, I get an syntax error on once of the files from enketo-transformer.

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/jgraham/central-dev/enketo-express/app/models/cache-model.js:5:21)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
/home/jgraham/central-dev/enketo-express/node_modules/enketo-transformer/dist/enketo-transformer/transformer.cjs:98
  lookupNamespaceURI: (prefix) => namespaces[prefix] ?? null

Any thoughts on what is going wrong here? Is this a problem others have experienced?

I am using node v12.22.12.

I'm not entirely sure whether this is the issue but I do notice that the getting started instructions are out of date, sorry about that! The requirement is node 14.8.0 or above. We generally recommend using Volta to manage node versions. It looks like this is explicit in every Enketo sub package's instructions except for Express. We'll be moving to a monorepo shortly so that (among other things) these kinds of instructions can be maintained in a single place.

Hi LN - thanks for this. Have not checked to confirm but this seems like it could be the problem.

1 Like