关于“Error: listen EADDRINUSE: address already in use 127.0.0.1:3000”

今天在做一个Vue小项目的时候,遇到了这样一个bug,终端输入npm run dev指令,本来按照我在package.json文件中配置的命令:"dev": "webpack-dev-server --open --port 3000 --hot",应该会运行webpack工具打包代码后,自动打开浏览器,监听3000端口,但是此时却在终端命令行提示出错,错误信息如下:

PS C:\Users\LXD\Desktop\my-vue\vue-cms> npm run dev

[email protected] dev C:\Users\LXD\Desktop\my-vue\vue-cms
webpack-dev-server --open --port 3000 --hot

events.js:174
      throw er; // Unhandled ‘error‘ event
      ^

Error: listen EADDRINUSE: address already in use 127.0.0.1:3000
    at Server.setupListenHandle [as listen2] (net.js:1253:19)
    at listenInCluster (net.js:1318:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1451:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10)
Emitted ‘error‘ event at:
    at emitErrorNT (net.js:1297:8)
    at process.
tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: webpack-dev-server --open --port 3000 --hot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\LXD\AppData\Roaming\npm-cache_logs\2019-05-23T14_10_58_853Z-debug.log
PS C:\Users\LXD\Desktop\my-vue\vue-cms>

根据错误提示,Error: listen EADDRINUSE: address already in use 127.0.0.1:3000,意思是3000端口已经被占用。这时,我寻找的解决方案为:

  1. 打开cmd
  2. 运行netstat -ano,找到报错信息提示的端口号那一行,记住最后那个数字

  3.接下来运行tskill “最后那个数字”,所以这里我运行的是tskill 8408

最后打开VSCode,在终端再次输入npm run dev,运行成功,问题解决。

原文地址:https://www.cnblogs.com/smalldy/p/10915046.html

时间: 2024-10-02 18:48:25

关于“Error: listen EADDRINUSE: address already in use 127.0.0.1:3000”的相关文章

nodejs出现events.js:72中抛出错误 Error: listen EADDRINUSE

<pre>events.js:72 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE at errnoException (net.js:901:11) at Server._listen2 (net.js:1039:14) at listen (net.js:1061:10) at Server.listen (net.js:1127:5) at Object.<anonymous> (./server

How to fix Error: listen EADDRINUSE while using nodejs

If I run a server with the port 80, and I try to use xmlHTTPrequest i get this error: Error: listen EADDRINUSE Why is it problem for nodejs, if I want to do a request, while I run a server on the port 80? For the webbrowsers it is not a problem: I ca

解决运行nodejs代码Error: listen EADDRINUSE

解决运行nodejs代码Error: <wbr>listen <wbr>EADDRINUSE 错误listen EADDRINUSE 是比较常见的错误.'EADDRINUSE',借助有道的翻译,意思是:错误地址使用.'EADDRINUSE'应该是'error address in use'的缩写.后来借助google找到了合理的解释,说是你监听的端口已经被使用了! 在网上找解决方法,绝大部分是绕道而行--就是把端口改掉.无奈,我只能用80端口.但是怎么办? 在不懂nginx得情况下

npm Error: listen EADDRINUSE 127.0.0.1:8080

EADDRINUSE 解析: E: error ADDR : address INUSE : in use 翻译 error : address in use ; | 地址已使用,端口被占用 解决办法 : 1. sudo lsof -i 8080 : 查看端口使用情况 2. sudo kill -9 43021 : 杀死展示的PID 原文地址:https://www.cnblogs.com/noraZhang/p/12635365.html

vue项目npm run dev报错events.js:160 throw er; // Unhandled &#39;error&#39; event listen EADDRINUSE :::8002

出错情况,如下图: 报错原因: listen EADDRINUSE :::8002 意思是当前8002端口被占用 解决办法: 一:简单粗暴:关掉可能影响的相关程序,重新执行启动. 二: 1.Win+R,cmd查询使用的端口号是否被占用: 输入命令:netstat -aon|findstr "8002" 按回车显示占用8080端口对应的程序的PID号:如下图: 2.根据PID号找到对应的程序: 输入命令:tasklist|findstr "12452" 按回车后显示出

Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE) mac下错误记录

架好的环境运行不了,nginx报错,根据提示是80端口被占用. p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff } span.s1 { } ERROR: for eagledock_nginx_1  Cannot restart container affabde5053648c62dbadb0c0e2f44b371e3f0f0c5058e2

在windows下运行docker的问题【Error getting IP address: ***】

环境配置系统:windows 10docker:Docker Toolbox https://www.docker.com/products/docker-toolbox 问题描述windows下安装完Docker Toolbox后运行Docker Quickstart Terminal可能会看到如下错误 Creating Machine default... Running pre-create checks... Creating machine... Error creating mach

ERROR: unable to bind listening socket for address &#39;127.0.0.1:9000&#39;: Address already in use (98)

刚安装完PHP,启动时报错: # /etc/init.d/php-fpm start Starting php-fpm [15-Apr-2017 13:21:13] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98) [15-Apr-2017 13:21:13] ERROR: FPM initialization failed failed 解决方法: #

Error running Tomcat8: Address localhost:1099 is already in use 错误解决

摘要: 有时候运行web项目的时候会遇到 Error running Tomcat8: Address localhost:1099 is already in use 的错误,导致web项目无法运行.这篇 blog 介绍了解决办法.      有时候运行web项目的时候会遇到 Error running Tomcat8: Address localhost:1099 is already in use 的错误,导致web项目无法运行.这明显是1099端口已经被占用,解决办法如下:     第一