【问题标题】:nodemon looking for file in C drive instead of project directory.nodemon 在 C 盘而不是项目目录中寻找文件。
【发布时间】:2017-04-12 20:15:31
【问题描述】:

我正在使用 nodemon 来监控我的文件更改。我的 package.json 脚本部分中有一个自定义脚本,如下所示:

  "scripts": {
    "start": "nodemon --ignore htm,html --ext cs,js --exec \"dotnet run --debug\" -V"
  }

我通过在与我的 package.json 文件相同的位置打开命令提示符并运行 npm run start 来运行它。当我运行该命令时,我收到以下错误:

The current project is not valid because of the folloding errors:
C:\<1,0>: error: DOTNET1017: Project file does not exist 'C:\project.json'.
[nodemon] app crashed - waiting for file changes before starting...

我不确定它为什么在 C 盘中查找。当我开始使用新的开发计算机时,这种情况就开始发生了——我的旧开发计算机从来没有出现过这个问题。我检查了两台计算机之间的节点、npm 和 nodemon 版本,它们完全相同。

【问题讨论】:

    标签: .net node.js angular nodemon


    【解决方案1】:

    您应该在命令中指定当前项目的入口点(或./,如果默认值有效):

    "scripts": {
        "start": "nodemon --ignore htm,html --ext cs,js --exec \"dotnet run --debug\" -V ./server.js"
      }
    

    【讨论】:

      【解决方案2】:

      要解决此问题,请参阅此 SO 帖子(原来有一个注册表值更改了当前工作目录):npm always using home directory as current working directory

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-08-08
        • 1970-01-01
        • 2015-09-03
        • 2016-10-03
        • 2018-10-18
        • 2016-08-08
        • 2022-09-27
        相关资源
        最近更新 更多