You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a Remix app with several cron jobs defined in TypeScript files that import other TypeScript files. I need to initialize these cron jobs when the server starts, in the server.ts file, by importing and calling a TypeScript function. When I do this, set the server: "./server/server.ts" key in my remix.config.js, and run npm run dev, I get an initial Remix internal server error, followed by the server restarting, and a different error once I try to visit the localhost URL:
npm run dev output
npm run dev
> dev
> remix build && run-p dev:*
Building Remix app in production mode...
Built in 133ms
> dev:remix
> remix watch
> dev:node
> cross-env NODE_ENV=development nodemon ./build/index.js --watch ./build/index.js
[nodemon] 2.0.16
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): build/index.js
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node ./build/index.js`
/Users/orion/Developer/Playgrounds/remix-custom-server/node_modules/@remix-run/server-runtime/routes.js:18
return Object.entries(manifest).filter(([, route]) => route.parentId === parentId).map(([id, route]) => ({ ...route, ^TypeError: Cannot convert undefined or null to object at Function.entries (<anonymous>) at Object.createRoutes (/Users/orion/Developer/Playgrounds/remix-custom-server/node_modules/@remix-run/server-runtime/routes.js:18:17) at Object.createRequestHandler (/Users/orion/Developer/Playgrounds/remix-custom-server/node_modules/@remix-run/server-runtime/server.js:26:25) at createRequestHandler (/Users/orion/Developer/Playgrounds/remix-custom-server/node_modules/@remix-run/express/server.js:34:28) at Object.<anonymous> (/Users/orion/Developer/Playgrounds/remix-custom-server/build/index.js:42:46) at Module._compile (node:internal/modules/cjs/loader:1112:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1166:10) at Module.load (node:internal/modules/cjs/loader:988:32) at Function.Module._load (node:internal/modules/cjs/loader:834:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)[nodemon] app crashed - waiting for file changes before starting...Watching Remix app in development mode...💿 Built in 153ms[nodemon] restarting due to changes...[nodemon] starting `node ./build/index.js`Express server listening on port 3000Error: listen EADDRINUSE: address already in use :::3000 at Server.setupListenHandle [as _listen2] (node:net:1422:16) at listenInCluster (node:net:1470:12) at Server.listen (node:net:1558:7) at Function.listen (/Users/orion/Developer/Playgrounds/remix-custom-server/node_modules/express/lib/application.js:635:24) at Object.<anonymous> (/Users/orion/Developer/Playgrounds/remix-custom-server/server/server.ts:44:5) at Module._compile (node:internal/modules/cjs/loader:1112:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1166:10) at Module.load (node:internal/modules/cjs/loader:988:32) at Function.Module._load (node:internal/modules/cjs/loader:834:12) at Module.require (node:internal/modules/cjs/loader:1012:19)[nodemon] app crashed - waiting for file changes before starting...
Why is this happening? According to the documentation, I should be able to use a TypeScript file for the server file, when specified in my config, as I have done. Is it because it's nested in a /server directory? Is it because it imports another local TypeScript file?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on a Remix app with several cron jobs defined in TypeScript files that import other TypeScript files. I need to initialize these cron jobs when the server starts, in the
server.ts
file, by importing and calling a TypeScript function. When I do this, set theserver: "./server/server.ts"
key in myremix.config.js
, and runnpm run dev
, I get an initial Remix internal server error, followed by the server restarting, and a different error once I try to visit the localhost URL:npm run dev
outputWhy is this happening? According to the documentation, I should be able to use a TypeScript file for the server file, when specified in my config, as I have done. Is it because it's nested in a
/server
directory? Is it because it imports another local TypeScript file?I created a minimal reproduction of the issue, using the default Remix Express starter.
Beta Was this translation helpful? Give feedback.
All reactions