【问题标题】:Running "nodemon index.js" launches Windows Script Host instead of VS: WSH Error Code 800A03F6运行“nodemon index.js”会启动 Windows 脚本主机而不是 VS:WSH 错误代码 800A03F6
【发布时间】:2020-08-25 11:26:48
【问题描述】:

我正在运行一个 node.js 应用程序并安装了 nodemon。

不幸的是,我从 Windows 上的 CMD 安装了它(我一直在从 VS 安装新软件包时遇到问题,因为它不会更新 PATH)。所以一旦我从 CMD 安装它,我使用 nodemom 运行命令,然后 Windows 询问我要使用什么工具。我有几个选择,其中包括 VS,但我按下了 Windows Bash 脚本......从那时起,即使我从 VS 终端运行 nodemom,我也一次又一次地收到与附加相同的错误。

我尝试禁用 WBS,但在注册表中没有找到确切的启用/禁用设置。

我也试过这个:https://answers.microsoft.com/en-us/windows/forum/windows_vista-windows_programs/microsoft-jscript-error-800a03ea/e8723445-77ea-4b13-b13e-afde15f22bfb enter image description here 我检查了 PATH 并且在用户和系统环境变量指向的情况下似乎都是正确的: ...npm\node_modules\nodemon\bin\

我还能做什么?

提前致谢!

【问题讨论】:

    标签: javascript windows bash nodemon


    【解决方案1】:

    当我尝试运行一个简单的 node.js express 应用程序时,当我的 package.json 中有以下代码时,我看到了相同的错误消息:

    {
      ...
      "start": "nodemon --exec src/index.js",
      ...
    }
    

    然后 Windows 也问我要使用哪个程序来执行它。

    我的解决方法是设置正确的解释器(在我的例子中是节点)。

    {
      ...
      "start": "nodemon --exec node src/index.js",
      ...
    }
    

    【讨论】:

      【解决方案2】:

      如果你使用window和babel编译,那么你可以试试:

      {
        ...
        "start": "nodemon --exec ./node_modules/.bin/babel-node ./src/index.js",
        ...
      }
      

      【讨论】:

        猜你喜欢
        • 2021-12-30
        • 2018-07-12
        • 2020-11-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-01-25
        • 2021-07-10
        相关资源
        最近更新 更多