Fly.io can't find ts-node dependency

I’m trying to deploy a server written in typescript to fly.io. Every time I deploy I’m met with this error.

2023-04-27T08:30:26Z [info]sh: 1: ts-node: not found
2023-04-27T08:30:26Z [info][nodemon] failed to start process, “ts-node” exec not found

The problem is that I have ts-node in my dependencies. Any suggestions as to how I can fix this issue? Any help would be greatly appreciated. I’m quite new to fly.io.

Hey @MKelsey looks like ts-node is not installed in your deployed image. Be sure it’s listed in your package.json’s dependencies. If it’s only in devDependencies, it might not get installed, for example, if NODE_ENV=production when your image is built.

Hey @guillaume thanks for the response. I do have it in my dependencies. This is my package.json file.

{
“name”: “server”,
“version”: “1.0.0”,
“description”: “”,
“main”: “index.ts”,
“scripts”: {
“test”: “jest”,
“start”: “npx nodemon”
},
“author”: “”,
“license”: “ISC”,
“devDependencies”: {
@types/bcrypt”: “^5.0.0”,
@types/cookie-parser”: “^1.4.3”,
@types/cors”: “^2.8.13”,
@types/express”: “^4.17.17”,
@types/jest”: “^29.5.0”,
@types/jsonwebtoken”: “^9.0.1”,
@types/mongoose”: “^5.11.97”,
@types/node”: “^18.15.11”,
@types/supertest”: “^2.0.12”,
“jest”: “^29.5.0”,
“nodemon”: “^2.0.22”,
“ts-jest”: “^29.1.0”,
“typescript”: “^5.0.3”
},
“dependencies”: {
“bcrypt”: “^5.1.0”,
“cookie-parser”: “^1.4.6”,
“cors”: “^2.8.5”,
“dotenv”: “^16.0.3”,
“express”: “^4.18.2”,
“i”: “^0.3.7”,
“jsonwebtoken”: “^9.0.0”,
“mongoose”: “^7.0.3”,
“nodemon”: “^2.0.22”,
“npm”: “^9.6.4”,
“puppeteer”: “^19.8.5”,
“supertest”: “^6.3.3”,
“ts-node”: “^10.9.1”,
“tsconfig-paths”: “^4.2.0”
}
}

Am I doing something wrong? Really appreciate the support!

Maybe try without npx in “start”: “npx nodemon”“start”: “nodemon”.

Or install ts-node globally in your Dockerfile (add RUN npm i -g ts-node)

1 Like

That seems to have fixed the ts-node issue. Now I’m encountering another problem. I’ll try and sort that one. Thanks @guillaume . I really appreciate it.

1 Like