如何查找侦听/使用我的tcp端口的进程?我在mac os x上.
有时,在崩溃或一些错误后,我的rails应用程序锁定端口3000.我找不到它使用ps -ef ...我怎么找到愚蠢的东西并杀死它,残忍......?
做的时候
rails server
Run Code Online (Sandbox Code Playgroud)
我明白了
已经在使用的地址 - bind(2)(Errno :: EADDRINUSE)
2014年更新:
要完成以下某些答案:执行kill命令后,可能需要删除pid文件 rm ~/mypath/myrailsapp/tmp/pids/server.pid
如何删除已分配给端口的当前进程/应用程序?
例如: localhost:8080
我正在测试在Windows 7上用nodejs编写的服务器,当我尝试在命令行中运行测试程序时,我得到以下错误
Error: listen EADDRINUSE
at errnoException (net.js:614:11)
at Array.0 (net.js:704:26)
at EventEmitter._tickCallback (node.js:192:40)
Run Code Online (Sandbox Code Playgroud)
如何在不重新启动的情况下修复它?
我正在制作一个http请求,应该每隔一分钟运行一次.以下是我的代码
var express = require("express");
var app = express();
var recursive = function () {
app.get('/', function (req, res) {
console.log(req);
//Some other function call in callabck
res.send('hello world');
});
app.listen(8000);
setTimeout(recursive, 100000);
}
recursive();
Run Code Online (Sandbox Code Playgroud)
根据上面的代码,我必须在每一分钟后得到答复.但我收到错误:听EADDRINUSE.任何有关这方面的帮助都会非常有帮助.
我正在尝试使用node-inspector调试我的代码,但我一次又一次地在终端窗口中收到此错误
$ sudo sails debug
info: Running app in debug mode...
info: You probably want to install / run node-inspector to help with debugging!
info: https://github.com/node-inspector/node-inspector
info: ( to exit, type <CTRL>+<C> )
Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at Agent.Server._listen2 (net.js:1156:14)
at listen (net.js:1182:10)
at Agent.Server.listen (net.js:1267:5)
at Object.start (_debugger_agent.js:20:9)
at startup (node.js:86:9)
at node.js:814:3
Run Code Online (Sandbox Code Playgroud)
解决
错误:听EADDRINUSE
我试过关闭其他终端窗口(我的节点检查器正在运行).我已经在StackOverflow上提到了答案,但它们没有用,我甚至尝试过这个命令来杀死进程:
$ killall -9 node
No matching processes belonging to you were found
Run Code Online (Sandbox Code Playgroud)
但仍然无法正常工作.有人请帮我解决这个问题.
我是一名初学程序员,正在尝试使用以下教程网站http://www.nodebeginner.org/#hello-world学习node.js
我到了试图设置服务器的地步,但是下面的代码出错了
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
Run Code Online (Sandbox Code Playgroud)
错误:
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:884:11)
at Server._listen2 (net.js:1022:14)
at listen (net.js:1044:10)
at Server.listen (net.js:1110:5)
at Object.<anonymous> (/Users/.........../server.js:7:4)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激
我创建了一个nodejs服务器(一个loginapp),但是当我尝试结点应用程序时,出现了一个错误(她不在这里):
events.js:167
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::5000
at Server.setupListenHandle [as _listen2] (net.js:1290:14)
at listenInCluster (net.js:1338:12)
at Server.listen (net.js:1425:7)
at Function.listen (C:\Users\Corentin\Documents\loginapp\node_modules\express\lib\application.js:618:24)
at Object.<anonymous> (C:\Users\Corentin\Documents\loginapp\app.js:81:5)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
Emitted 'error' event at:
at emitErrorNT (net.js:1317:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
Run Code Online (Sandbox Code Playgroud)
我认为与mongo有联系,但我没有看到错误,
这是我的app.js代码(不是全部),问我是否需要更多我的代码
var …Run Code Online (Sandbox Code Playgroud) 当我输入"node site.js"时我得到了这个,我100%确定我没有运行这个节点两次.
Error: listen EADDRINUSE :::3000
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at Server._listen2 (net.js:1262:14)
at listen (net.js:1298:10)
at Server.listen (net.js:1376:9)
at Server.listen.Server.attach (/root/node_modules/socket.io/lib/index.js:228:9)
at Timeout._onTimeout (/root/nodejs/site.js:1005:29)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
code: 'EADDRINUSE',
errno: 'EADDRINUSE',
syscall: 'listen',
address: '::',
port: 3000 }
Run Code Online (Sandbox Code Playgroud)
我正在使用FEDORA 23
作为初学者使用 node.js 时,我在编写用于在 localhost:8080 上显示我的 url 的不同部分的代码时遇到了问题。检查下面提到的代码,如果发现任何错误,请纠正我:- node.js 文件的代码