Sh: 1: ts-node: Permission denied

i am getting this wierd error.

its working fine on my local device but failing on Render environment.

this is an example of the log

Running ‘npm start’
Nov 5 11:52:34 PM
Nov 5 11:52:34 PM > bookhive-backend@1.0.0 start
Nov 5 11:52:34 PM > nodemon start index.ts
Nov 5 11:52:34 PM
Nov 5 11:52:35 PM [nodemon] 3.0.1
Nov 5 11:52:35 PM [nodemon] to restart at any time, enter rs
Nov 5 11:52:35 PM [nodemon] watching path(s): .
Nov 5 11:52:35 PM [nodemon] watching extensions: ts,json
Nov 5 11:52:35 PM [nodemon] starting ts-node start index.ts
Nov 5 11:52:35 PM sh: 1: ts-node: Permission denied

Have you solved this problem? I just have a same problem now.

No I havnt solved that.
Try to start your application with tsnode --respwn instead of Nodemon

Yea i fixed it.

use this solution

The problem is that the render environment is not seeing your ts-node.

now do this
on your codebasa delete and resinstall nodemodules again like this rm -rf node_modules
now install debug with npm install debug

then add a prestart script to your package.json

the prestart script should point to ts-node binary and give it an executable permision like this
chmod +x node_modules/.bin/ts-node.

your start script should be like this

“script”:{
“prestart”: “chmod +x node_modules/.bin/ts-node”,
“start”: “ts-node index.ts”,
}

or

“script”:{
“prestart”: “chmod +x node_modules/.bin/ts-node”,
“start”: “nodemon index.ts”,
}

if you are using nodemon

now redeploy again, this should solve your problem,

thank you.

let me know if you have any other issue.

the chmod +x in front of the ts-node binary is giving the binary an executable permission

1 Like

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