Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run typescript compiler from shell command - permission denied

I'm using Parallels because I prefer the Mac OS but the work we do is all in Visual Studio. We currently have a build.cmd batch file that builds our typescript files. Because I'd prefer to work on the Mac side when I can, I thought I would rewrite the script in bash and to also get some experience writing a shell script. I have a main build.sh command that runs the other shell scripts like compile-templates.sh and compile-source.sh. I am trouble with the compile-source.sh portion now. Currently, the batch file looks like:

echo TypeScript Version:
CALL node_modules\.bin\tsc  -v

The typescript compiler is included in our Solution so we are all using the same one throughout the solution. In my compile-source.sh, I try to do this:

node_modules/.bin/tsc -v 

or this

./node_modules/.bin/tsc -v 

And I get permission denied. Is there something I'm doing wrong?

like image 845
Crystal Avatar asked Sep 02 '26 18:09

Crystal


1 Answers

There are several approaches to try. You can use bash to run the script like this:

bash node_modules/.bin/tsc -v

Or you can try to change the permissions on the file:

chmod a+x node_modules/.bin/tsc

This should enable you to run the script like this:

./node_modules/.bin/tsc -v

But in that case, make sure your script starts with a shebang line to tell the system it is a bash script:

#!/usr/bin/env bash
like image 102
rje Avatar answered Sep 05 '26 14:09

rje



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!