节点.JS: 获取错误 : [nodemon] 内部监视失败: 监视 ENOSPC

2022-08-30 01:50:23

我刚刚第一次在我的操作系统上安装。我还安装了.安装过程的下一步是安装 。这一切都很好。Node.jsUbuntu 14.04npmnodemon


但是,当我在命令行中键入nodemon应用程序.js来运行nodemon时,我收到以下错误...

[nodemon] 1.8.1 [nodemon] to restart at any time, enterrsnode app.js [nodemon] watching: *.* [nodemon] starting [nodemon] Internal watch failed: watch ENOSPC

在命令行中的错误...

alopex@Alopex:~/Desktop/coding_dojo/week-9/javascript/node/testing_node$ Hello World

为什么会发生这种情况?这是 nodemon 的正常行为吗?如果没有,我该如何解决?


附注...

1)是一个内部文件。
2)版本是
3)版本是
4)版本是
5)版本是...app.jsJavascriptconsole.log(111)nodev0.10.25npm1.3.10nodemon1.8.1ubuntu

Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:    14.04
Codename:   trusty

答案 1

似乎我的最大端口配置不正确。我运行了以下代码,它的工作原理...

echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

此命令的作用是增加单个用户允许的监视数。默认情况下,该数字可以较低(例如 8192)。当尝试监视大量目录的更改时,它必须创建多个监视,这可能会超过该限制。nodemon

您也可以通过以下方式解决此问题:

sudo sysctl fs.inotify.max_user_watches=582222 && sudo sysctl -p

但是它首先的编写方式将使此更改永久化。


答案 2

在运行的节点服务器上显示以下错误和解决方案:

nodemon server.js

[节点] 1.17.2

[nodemon] 随时重新启动,请输入rs

[nodemon] watching: .

[节点] 启动node server.js

[节点]内部监视失败:监视 /home/aurum304/jin ENOSPC

sudo pkill -f node

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p