Deploy: Tsx error --loader flag was deprecated in Node v20.6.0

Hello everyone, hope you’re doing great!
I ran fly launch to create my application, and then fly deploy --app
everything is going fine, the build works and then I get an error from tsx :

 > [build 6/6] RUN npm run build:
#0 0.596 
#0 0.596 > build
#0 0.596 > run-s build:*
#0 0.596 
#0 1.109 
#0 1.109 > build:remix
#0 1.109 > remix build --sourcemap
#0 1.109
#0 2.156 [info] building... (NODE_ENV=production)
#0 5.826 [info] built (3.6s)
#0 7.130
#0 7.130 > build:server
#0 7.130 > tsx ./server/build-server.ts
#0 7.130
#0 7.360
#0 7.360 node:internal/process/esm_loader:40
#0 7.360       internalBinding('errors').triggerUncaughtException(
#0 7.360                                 ^
#0 7.360 Error: tsx must be loaded with --import instead of --loader
#0 7.360 The --loader flag was deprecated in Node v20.6.0
#0 7.360     at Q (file:///myapp/node_modules/tsx/dist/esm/index.mjs:1:1880)
#0 7.360     at Hooks.addCustomLoader (node:internal/modules/esm/hooks:202:24)
#0 7.360     at Hooks.register (node:internal/modules/esm/hooks:168:16)
#0 7.360     at async initializeHooks (node:internal/modules/esm/utils:167:5)
#0 7.360     at async customizedModuleWorker (node:internal/modules/esm/worker:104:24)
#0 7.360
#0 7.360 Node.js v18.19.0
#0 7.374 ERROR: "build:server" exited with 1.

Any idea on why this could be happening ? Didn’t find anything on our dear web, and build command is working fine locally, only have it with the fly build

Any help appreciated :slight_smile: !

If this can help, upgrade tsx version to the latest will solve it

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.