TL;DR
I cannot execute commands such as tsc unless I include npx before it (e.g npx tsc). How can I fix this?
The title is a bad explanation of the problem I have.
Say I have installed an npm package with a CLI with it (typescript in this example). And the CLI is used like
tsc <filename> or just tsc. But whenever I try to do it like that, I get an error like
'tsc' is not recognized as an internal or external command,
operable program or batch file.
But... when I do
npx tsc
then it works!
So whats the problem?
The problem with doing npx tsc is because
- npx is slow at executing commands
- its annoying having to type
npxand the front of every command.
And the thing is, this was originally not a problem with WSL.
Why dont you just use WSL?
I have always had problems with WSL (primarily permission issues due to security reasons) and so I uninstalled WSL and just used command prompt. I would have perferred using WSL but it was simply not an option.
Other Info:
- I am using Windows command prompt.
- I have installed the packages globally
So is there a way to just execute commands that way or is it Command prompts fault?
tscand other such commands) and work as long as node is in the path environment variable. By installing them locally, you need to usenpxeverywhere.npxif you want to run things manually, inside npm scripts, you don't. On that note, why would you need to runtscmanually instead of having it be part of your project's build script(s)?