【问题标题】:Cannot run globally installed npm packages on Windows 10无法在 Windows 10 上运行全局安装的 npm 包
【发布时间】:2018-02-04 23:11:17
【问题描述】:

我已经在 Windows 10 机器上安装了 typescriptnodemon(使用标准 npm install -g [package-name])但是当我通过终端运行它们时,我打开了应用程序选择器窗口,我需要在其中选择我将使用哪个应用程序来打开它文件。

谁能告诉我如何解决它?它可以与安装的 Visual Studio 有关吗?非常感谢任何帮助。

谢谢!

【问题讨论】:

    标签: windows typescript npm nodemon


    【解决方案1】:

    好的,我已经找到了几个解决方案。

    观察到的问题

    上面提到的包有绑定到 Unix shell 的文件并且没有 Windows 批处理脚本可以运行。例如:

    解决方案

    1. 创建名为tsc.cmd 的文件(如果tscC:\Users\[username]\AppData\Roaming\npm\node_modules\typescript\bin 目录中)并在其中放入以下代码:

      @node "%~dpn0" %*

    2. 使用开箱即用的 Git Bash 非常适合我 :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-23
      • 1970-01-01
      • 1970-01-01
      • 2018-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多