#npx prisma db seed not working in ubuntu server

12 messages · Page 1 of 1 (latest)

lucid urchin
#

I'm deploying my server on a Ubuntu vps and when i run
npx prisma db seed
I am getting this error:

➜  sepal-server git:(master) npx prisma db seed
Environment variables loaded from .env
Running seed command `ts-node prisma/seed.ts` ...
/home/ubuntu/pertento/apps/sepal/sepal-server/node_modules/ts-node/dist/index.js:851
            return old(m, filename);
                   ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/ubuntu/pertento/apps/sepal/sepal-server/node_modules/strip-ansi/index.js from /home/ubuntu/pertento/apps/sepal/sepal-server/node_modules/gauge/wide-truncate.js not supported.
Instead change the require of index.js in /home/ubuntu/pertento/apps/sepal/sepal-server/node_modules/gauge/wide-truncate.js to a dynamic import() which is available in all CommonJS modules.
    at require.extensions.<computed> [as .js] (/home/ubuntu/pertento/apps/sepal/sepal-server/node_modules/ts-node/dist/index.js:851:20)
      ..........
      .........
    at Object.<anonymous> (/home/ubuntu/pertento/apps/sepal/sepal-server/node_modules/ts-node/dist/bin.js:579:5) {
  code: 'ERR_REQUIRE_ESM'
}

An error occurred while running the seed command:
Error: Command failed with exit code 1: ts-node prisma/seed.ts
➜  sepal-server git:(master)
  • It works fine on my machine (macOSx)
  • npx prisma db push worked perfectly, on the server, after generate

How can i fix this?

Thank you

spiral ocean
#

This is a typescript project, yes? Could you share your tsconfig.json

lucid urchin
#

@spiral ocean , just figured out the problem. I had to change the nodejs version back to v18, reinstall node_modules and everything works now

#

sorry for the troubles

spiral ocean
#

No problem at all. Which version of NodeJS were you using?

lucid urchin
#

latest, 20+

spiral ocean
#

interesting. That shouldn't happen. I'll bring it up to engineering. Thank you!

lucid urchin
#

but i don't think it has to do with Prisma directly

#

i tried running nest start and nest build and i got the same problem, but from different modules

lucid urchin
#

@spiral ocean , also unsurprisingly, everything works like a charm if i just use bun and bunx hahha

spiral ocean
#

lol always the answer apparently

lucid urchin
#

I am amazed with