Back

Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/code-start/src/main.js

  • 0
  • Functions
Andrik
10 May, 2024, 08:11

I'm trying to execute my first function in the Appwrite and I faces with this error. I'm using NodeJS -18.0 and in my script I only have test print example. Pls help me to figure out the problem

TL;DR
Developer encountered an "Error [ERR_REQUIRE_ESM]" when trying to run a function in their app using Node.js 18.0. Potential issue with ES Module in the main.js file. Solution: Convert the file to CommonJS by adding "type": "module" in the package.json or changing the file extension to .cjs.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more