本文介绍了Node.JS:出现错误:[nodemon]内部监视失败:监视ENOSPC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是第一次将Node.js安装在我的Ubuntu 14.04操作系统上.我还安装了npm.我的安装过程的下一步是安装nodemon.这一切都很好.

I just installed Node.js on my Ubuntu 14.04 operating system for the first time. I also installed npm. The next step in my installation process was installing nodemon. This all worked out fine.

但是,当我在命令行中键入nodemon app.js运行nodemon时,出现以下错误...

But, when I run nodemon by typing nodemon app.js in my command line, I get the following error...

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

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

在错误下方的命令行中...

In the command line below the error...

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

为什么会这样?这是nodemon的正常行为吗?如果没有,我该如何解决?

Why is this happening? Is this normal behavior for nodemon? If not, how can I fix it?

旁注...

Side notes...

1)app.js是其中包含console.log(111)Javascript文件.
2)node版本是v0.10.25
3)npm版本是1.3.10
4)nodemon版本是1.8.1
5)ubuntu版本是...

1) app.js is a Javascript file with console.log(111) inside of it.
2) node version is v0.10.25
3) npm version is 1.3.10
4) nodemon version is 1.8.1
5) ubuntu version is...

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

推荐答案

似乎我的最大端口配置不正确.我运行了以下代码,它起作用了……

It appears that my max ports weren't configured correctly. I ran the following code and it worked...

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

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

What this command does is to increase the number of watches allowed for a single user. By the default the number can be low (8192 for example). When nodemon tries to watch large numbers of directories for changes it has to create several watches, which can surpass that limit.

您还可以通过以下方法解决此问题:

You could also solve this problem by:

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

但是它的最初编写方式将使这一更改永久化.

But the way it was written first will make this change permanent.

这篇关于Node.JS:出现错误:[nodemon]内部监视失败:监视ENOSPC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-15 11:28