Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running npx tsconfig.json opens a bash script (WIndows) #18

Closed
omar-shahid opened this issue Jan 22, 2021 · 10 comments
Closed

Running npx tsconfig.json opens a bash script (WIndows) #18

omar-shahid opened this issue Jan 22, 2021 · 10 comments

Comments

@omar-shahid
Copy link

The ouput:

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -x "$basedir/node" ]; then
  "$basedir/node"  "$basedir/../tsconfig.json/src/index.js" "$@"
  ret=$?
else 
  node  "$basedir/../tsconfig.json/src/index.js" "$@"
  ret=$?
fi
exit $ret
@juddbaguio
Copy link

same thing happened

@davidkhierl
Copy link

same here as well 👀

@samihamine
Copy link

Me too 👀

@BronzW
Copy link

BronzW commented Mar 23, 2021

It's because it's mistaking the file for a json file (because of the file ending), and instead of running it, it simply opens it

@BronzW
Copy link

BronzW commented Mar 23, 2021

How to fix:

  1. Navigate to where Yarn or NPM has their bin (For yarn C:/Users/username/AppData/Local/Yarn/bin and npm C:/Users/username/AppData/Roaming/npm) (thanks kevincharless))
  2. Rename the tsconfig.json and tsconfig.json.cmd to tsconfig and tsconfig.cmd
  3. Run it locally as just tsconfig and it should work (npx tsconfig.json wont)
    image

@kevincharless
Copy link

Thanks @BronzW and (For npm C:/Users/username/AppData/Roaming/npm)

@omar-shahid
Copy link
Author

@BronzW thanks for your solution!

@BM-BrunoMarques
Copy link

BM-BrunoMarques commented Oct 20, 2022

Awesome @BronzW 🎉

It kind of worked for me except that I couldn't run it from writing tsconfig.
If you have the same problem just drag and drop the tsconfig.cmd to the vsCode terminal, where you have your project running and press enter.
Or change the following path accordingly with your username and press enter :
c:/Users/username/AppData/Local/Yarn/bin/tsconfig.cmd

@Jamal8548
Copy link

Jamal8548 commented Jan 30, 2023

Thanks @BronzW
Guys! I have changed the name of the files from cmd after navigating to C:/Users/username/AppData/Roaming/npm) from cmd. It works.

@Munna5553
Copy link

how i fix this issue

  1. going to location
    C:\Users\shaur\AppData\Local\npm-cache_npx\bb22b66c4c94b5c9\node_modules.bin
    if this different your folder but i tell you how to navigate there

if this file is open just check the location of above
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")

case uname in
CYGWIN|MINGW|MSYS) basedir=cygpath -w "$basedir";;
esac

if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../tsconfig.json/src/index.js" "$@"
ret=$?
else
node "$basedir/../tsconfig.json/src/index.js" "$@"
ret=$?
fi
exit $ret
Screenshot 2024-05-20 225109

and remove this both file and then run npx tsconfig.json it work
Screenshot 2024-05-20 225325

if it's work please follow me on githuba and linkedIn for more such things

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants