KarlstensK
Convex Community3y ago
10 replies
Karlstens

Trouble with ESM-style import in Node.js Quickstart

Hello, I'm new to convex and working through the Quickstart documentation. I've run through the steps detailed here - https://docs.convex.dev/quickstart/nodejs but unfortunately am after running through all the steps. My environment is VS Code, BASH terminal and Node.JS 20.6.

Upon running the final script.js I get this return.

$ node script.js
C:\DEV\VS Code\Convex\my-project\convex\_generated\api.js:12
import { anyApi } from "convex/server";
^^^^^^

SyntaxError: Cannot use import statement outside a module


Unfortunately this is very deep-end-of-the-pool for me, but just giving my feedback as my first experience to following the quick-start that I'm essentially stuck.
Add Convex to a Node.js project
Node.js Quickstart | Convex Developer Hub
Was this page helpful?