Single

Node.js异常 Error: listen EACCES 127.0.0.1:8000解决方法

Node.js异常信息

<code class="hljs vbscript has-numbering">Error: listen EACCES 127.0.0.1:8000
    at Object.exports._errnoException (util.js:1018:11)
    at exports._exceptionWithHostPort (util.js:1041:20)
    at Server._listen2 (net.js:1245:19)
    at listen (net.js:1294:10)
    at net.js:1404:9
    at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:62:16)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:81:10)

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "D:\nodejs\node.exe" "D:\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat@0.0.0 start: `http-server ./app -a localhost -p 8000 -c-1`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat@0.0.0 start script 'http-server ./app -a localhost -p 8000 -c-1'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     http-server ./app -a localhost -p 8000 -c-1
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-phonecat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     E:GitRepositoryangular-phonecatnpm-debug.log</code>

解决方法

异常为8000端口被占用导致的,查看windows下8000端口占用情况

<code class="hljs tex has-numbering">E:GitRepositoryangular-phonecat>netstat -ano|findstr "8000"
  TCP    0.0.0.0:8000           0.0.0.0:0              LISTENING       18480
  TCP    127.0.0.1:8000         127.0.0.1:50236        TIME_WAIT       0
  TCP    127.0.0.1:8000         127.0.0.1:50237        TIME_WAIT       0
  TCP    127.0.0.1:8000         127.0.0.1:50238        TIME_WAIT       0
  TCP    127.0.0.1:8000         127.0.0.1:50239        TIME_WAIT       0
  TCP    127.0.0.1:8000         127.0.0.1:50240        TIME_WAIT       0
  TCP    127.0.0.1:8000         127.0.0.1:50286        TIME_WAIT       0
  TCP    127.0.0.1:50285        127.0.0.1:8000         TIME_WAIT       0
  UDP    0.0.0.0:8000           *:*                                    18480</code>

因为进程0为系统进程,执行“taskkill /pid 0”后发现杀不掉。所以,另想办法,换端口,如下:
在node的安装根目录下,找到package.json,搜索8000,然后替换为8888

然后再在命令行执行命令npm start,启动成功

浏览器中输入http://localhost:8888,可以看到成功访问

下面关于的内容你可能也喜欢

在 Ubuntu 14.04/15.04 上安装配置 Node.js v4.0.0 http://www.linuxidc.com/Linux/2015-10/123951.htm

Ubuntu 14.04下搭建Node.js开发环境 http://www.linuxidc.com/Linux/2014-12/110983.htm

CentOS 6.9安装配置Node.js http://www.linuxidc.com/Linux/2017-10/147665.htm

Node.Js入门[PDF+相关代码] http://www.linuxidc.com/Linux/2013-06/85462.htm

Node.js调试图文详解 http://www.linuxidc.com/Linux/2017-03/141636.htm

Node.js开发指南 高清PDF中文版 +源码 http://www.linuxidc.com/Linux/2014-09/106494.htm

Linux下安装Node.js详细完整教程 http://www.linuxidc.com/Linux/2017-01/139726.htm

Ubuntu 16.04 64位 搭建 Node.js NodeJS 环境 http://www.linuxidc.com/Linux/2016-09/135487.htm

:请点这里
:请点这里

:http://www.linuxidc.com/Linux/2017-10/148106.htm

暂无评论

发表评论