Search code examples
windowstypescriptnpmnodemon

Cannot run globally installed npm packages on Windows 10


I have installed typescript and nodemon on Windows 10 machine (using standard npm install -g [package-name]) however when I run them through terminal I got application selector window opened where I need to choose which app I will use to open that file.

Could anyone point me out how to resolve it? Can it be related to installed Visual Studio? Any help is much appreciated.

Thank you!


Solution

  • All right, I have found couple of solutions for this.

    Observed problem

    Above mentioned packages has files which bounded to Unix shell and does not has Windows batch scripts to run. For example:

    tsc file content

    Solutions

    1. Create file (in case tsc in C:\Users\[username]\AppData\Roaming\npm\node_modules\typescript\bin directory) named tsc.cmd and put following code inside:

      @node "%~dpn0" %*

    2. Use Git Bash which worked perfectly for me out of the box :)