'tsc' is not recognized as an internal or external command on Windows when installed globally - node.js

I've seen bunch of 'tsc' is not recognized as an internal or external command issues here on StackOverflow but none of them could help me solve my problem.
I've installed typescript globally with:
npm install -g typescript
There are tsc and tsc.cmd files in C:\Users\<user_name>\AppData\Roaming\npm directory. So %AppData%\npm\tsc --version command works.
I've got C:\Users\<user_name>\AppData\Roaming\npm directory in my user's PATH.
More, when I run where tsc command in arbitrary directory, I get:
C:\Users\<user_name>\Desktop>where tsc
C:\Users\<user_name>\AppData\Roaming\npm\tsc
C:\Users\<user_name>\AppData\Roaming\npm\tsc.cmd
However, when I simply try to run tsc, I got:
C:\Users\<user_name>\Desktop>tsc
'tsc' is not recognized as an internal or external command,
operable program or batch file.
Exactly the same problem occurs with grunt and uglifyjs.

I managed to solve this problem.
C:\Users\<user_name>\AppData\Roaming\npm indeed was in user's PATH variable. I also have system variable called Path (yes, just first letter is uppercased) and there was no C:\Users\<user_name>\AppData\Roaming\npm in there.
When I added it to system's Path, it finally started to work.
Not sure that this is ok that two of my path variables have different names (in terms of cases). Also not sure that this situation led to problems.
Would be glad if someone could clarify this.

Try installing the linux console for windows the cygwin console., And run the command tsc from that console, I know it does not change much but sometimes I have solved many problems with that console.
https://www.cygwin.com/

Related

How to run NodeJS CLI tools without having to type npx

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 npx and 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?
! this only works for Windows !
Ok, so I came across this post and thankfully, the first answer there was the solution!
Just add %USERPROFILE%\AppData\Roaming\npm to the path variable in system variables!
To access the system variables, press the Windows key, type Environment variables and click on Environment variables at the bottom of the window. The path variable can be found under User variables for (profile name).

'tsc' is not recognized as an internal or external command, operable program or batch file. - Windows 7

I'm new here to Typescript and I'm trying to install it globally on my machine.
I currently have the following versions:
Node v.11.13.0
npm v6.7.0
When I run npm install -g typescript I get the following results:
C:\Users[userid].node_modules_global\tsc ->
C:\Users[userid].node_modules_glob al\node_modules\typescript\bin\tsc
C:\Users[userid].node_modules_global\tsserver ->
C:\Users[userid].node_modules
_global\node_modules\typescript\bin\tsserver
+ typescript#3.4.2 updated 1 package in 3.297s
The moment I run tsc or tsc -v on my command line, I receive the
'tsc' is not recognized as an internal or external command, operable
program or batch file.
I have uninstalled node and reinstalled it, but I still get the same error.
I have consulted Google and followed other methods on Stackoverflow to fix this problem, including checking the PATH folder structure.
I am not sure what I am doing wrong here, please help.
FYI I am running a Windows 7 PC.
In your command prompt, try executing the below command,
set path=%PATH%;c:\Users\YOUR_USER_DIRECTORY\AppData\Roaming\npm;
Then try executing your tsc command again, you will get it executed now.
Hope this helps!
FOUND IT!
Ok so I dug around and discovered the following:
Under User\[pc_name]\.node_modules_global I found the tsc and tsc.mcd files. All I did was copy those two files across to ...\Roaming\npm.
After doing that I ran tsc in my command prompt and it worked!

YEOMAN YO ERROR yo it is not recognized as an internal or external command, program or batch file executable.

When installing node.js for the first time and using the YEOMAN library, I found that it did not recognize the library despite installing it correctly.
When executing in console
yo swaggerize
Returns the error "yo it is not recognized as an internal or external command, program or batch file executable"
After several laps the problem is in node.js and in the PATH.
I post the solution in the next post.
The solutiĆ³n for me, it's simple.
In windows-> go to pc properties->advanced configuration-> environment variables
Show Path variable and edit.
C:\Users\youruser\AppData\Roaming\npm;
C:\Program Files\nodejs;
Save restart your console and run the command again
Each and every thing was fine
only problem was path
so I set path in environment variable.
This path I set in environment variabel
C:\Users\user\.npm-packages
where 'user' is my user name, please use your user name.
Then my 'yo', 'bower' command start to executed
Thanks

Fly command won't work after installing flight plan

So I was working through a tutorial to deploy my node app to a server. They had me npm install flightplan -g so I can use the 'fly' command. This all worked but for the fly command to work I needed to install rsync. I finally got rsync to work after changing my PATH. But now when I use to fly command I get "'fly' is not recognized as an internal or external command,
operable program or batch file."
I've tried changing the PATH hundreds of times to different things and I can't for the life of my get the fly command to work again. I've tried reinstalling flightplan globally a bunch of times. NOTHING IS WORKING.
Node JS NPM modules installed but command not recognized
This was the answer I was looking for.. I had the end of my path set to npm/fly and not just npm....

I can't run test with "vows test/*" command on windows. How to use it? node.js

I've installed vows as module of my project and I've added the path "node_modules\vows\bin" to my environment path variable of windows vista.
note: I've also renamed "node_modules\vows\bin\vows" to vows.exe, because without the extension I get this error: 'vows' is not recognized as an internal or external command,
operable program or batch file.
Now wherever I put "vows" in my cmd in windows nothing happens, I cd into my test folder and I run "vows myFirstTest.js" and nothing happens. (when I say nothing happens my cursor in cmd is going to the top and then return to it's original position and it's doing this forever, therefore each time I try a vows command in cmd I have to close the cmd to run another command).
What I'm doing bad?
thanks
NPM is great at globally installing packages and making the executable for each operating system (UNIX-ish + Windows), so proceed with the following:
npm install -g vows

Resources