0
Initializing node_modules, hold on...
node v12.0.0, with pnpm
Installing...
Performing headless installation
Resolving: total 1, reused 0, downloaded 0
Resolving: total 1, reused 0, downloaded 0
Packages: +85
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Resolving: total 85, reused 84, downloaded 1
Resolving: total 85, reused 84, downloaded 1, done
dependencies:
+ discord.js 11.4.2
+ dotenv 8.2.0
+ express 4.17.1
+ rgb-hex 3.0.0
+ util 0.12.3
Total install time: 3722ms

我的应用程序节点总是在每次打开时自己重新安装。我的应用程序会在几分钟后关闭。我怎样才能在每个开口处停止安装?

4

1 回答 1

1

回答

要在每次更改文件中的内容时停止自动安装和重新启动,您必须创建一个名为watch.json的文件。

例子

首先在根级别创建watch.json 。节流时间指定更改开始后等待的时间

禁用整个项目的自动重启

{
  "install": {
    "include": [
      "^.trigger-rebuild$"
    ]
  },
  "throttle": 100
}

在公共目录上禁用自动重启并在使用 .js 文件进行更改时重新启动

{
  "install": {
    "include": [
      "^\\.env$"
    ]
  },
  "restart": {
    "exclude": [
      "^public/"
    ],
    "include": [
      "\\.js$"
    ]
  },
  "throttle": 100
}

参考

watch.json 示例

于 2020-09-18T20:45:23.903 回答