HanielU / sk-trpc-payload

A turborepo template featuring Sveltekit and Payload CMS, ready to be deployed to a single node server - specifically using https://railway.app.
MIT License
41 stars 2 forks source link

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".mts" #3

Open koakh opened 1 year ago

koakh commented 1 year ago

when run project it gives bellow error on server any clue on how to solve it

@apps/server:dev: [nodemon] starting `ts-node src/server.mts`
@apps/server:dev: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".mts" for /mnt/storage/Development/Svelte/SvelteKit/SvelteKitPayloadCMSTRPCTurborepo/sk-trpc-payload/apps/server/src/server.mts
@apps/server:dev:     at new NodeError (node:internal/errors:399:5)
@apps/server:dev:     at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:99:9)
@apps/server:dev:     at defaultGetFormat (node:internal/modules/esm/get_format:139:38)
@apps/server:dev:     at defaultLoad (node:internal/modules/esm/load:83:20)
@apps/server:dev:     at nextLoad (node:internal/modules/esm/hooks:735:28)
@apps/server:dev:     at load (/mnt/storage/Development/Svelte/SvelteKit/SvelteKitPayloadCMSTRPCTurborepo/sk-trpc-payload/node_modules/.pnpm/ts-node@10.9.1_xe2tsftiwm5y3a5xnbnynihbxy/node_modules/ts-node/dist/child/child-loader.js:19:122)
@apps/server:dev:     at nextLoad (node:internal/modules/esm/hooks:735:28)
@apps/server:dev:     at Hooks.load (node:internal/modules/esm/hooks:380:26)
@apps/server:dev:     at MessagePort.handleMessage (node:internal/modules/esm/worker:165:24)
@apps/server:dev:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:762:20) {
@apps/server:dev:   code: 'ERR_UNKNOWN_FILE_EXTENSION'
@apps/server:dev: }
@apps/server:dev: [nodemon] app crashed - waiting for file changes before starting...

awesome repo starter budie

thanks

HanielU commented 1 year ago

@koakh What is your node version?

koakh commented 1 year ago

hello @HanielU

first: thanks for your reply and awesome repo

second: sorry for the delay, I only see this message right now

my node version is

node -v
v20.2.0

thanks but I can change for any other with nvm, just say the version that you use and I change it

if I use latest LTS like v18.16.0 it fails with other errors, for ex

@apps/server:dev: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /mnt/storage/Development/Svelte/SvelteKit/SvelteKitPayloadCMSTRPCTurborepo/sk-trpc-payload/apps/server/src/trpc/router.mts
@apps/server:dev: require() of ES modules is not supported.

thanks

UPDATE: I think I fix it in node v18.16.0 project is already running, I made some changes to work with *nix, because the original project are to tied to windows, and we must change some things to work

I can make some notes of the changes and send or make a PR but first I must test project and clean some things to have only the changes that are useful

HanielU commented 1 year ago

@koakh That's fine if you can make a PR

My node version

node -v
v18.12.1
sudmann commented 1 year ago

Any update on this? I'm facing the same issue and would like to know how to resolve it.

koakh commented 1 year ago

What problem do you have, This one? TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".mts"

In my case, I solve it using

node -v v18.12.1

Like it was reported above, if you have any other problem, please specify it