npm start上的webpack-dev-server错误

时间:2016-11-22 19:15:50

标签: node.js npm webpack webpack-dev-server

我正在尝试在ng2-admin上运行npm start,所有工作都在工作,直到我做了npm更新以尝试更新pacakages,

之后,npm开始并出现错误:

webpack-dev-server --config config/webpack.dev.js --progress --profile --watch --content-base src/
10% building modules 3/3 modules 0 activeError: listen EADDRINUSE 127.0.0.1:8080
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at Server._listen2 (net.js:1257:14)
at listen (net.js:1293:10)
at net.js:1403:9
at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:62:16)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:81:10)
npm ERR! Darwin 15.5.0
npm ERR! argv "/Users/vm/versions/node/v6.9.1/bin/node" node/v6.9.1/bin/npm" "run" "server:dev"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! ng2-admin@0.7.0 server:dev: webpack-dev-server --config config/webpack.dev.js --progress --profile --watch --content-base src/
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ng2-admin@0.7.0 server:dev script 'webpack-dev-server --config config/webpack.dev.js --progress --profile --watch --content-base src/'.
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 ng2-admin package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack-dev-server --config config/webpack.

2 个答案:

答案 0 :(得分:2)

错误消息的相关部分是:listen EADDRINUSE 127.0.0.1:8080。这意味着webpack-dev-server正在尝试在127.0.0.1:8080上运行,但地址和端口已在使用中。

尝试打开浏览器并在地址栏中输入127.0.0.1:8080。也许已经有另一台服务器在该端口上运行。运行jobs以检查后台进程。

答案 1 :(得分:1)

将package.json中的依赖项更改为

“webpack-dev-server”:“2.1.0-beta.10”, 而不是像

那样的东西

“webpack-dev-server”:“^ 2.1.0-beta.9”,

之后运行npm install或npm update。