【问题标题】:Angular 2, Node js Error npm run server:prodAngular 2,Node js 错误 npm run server:prod
【发布时间】:2017-06-04 12:46:06
【问题描述】:

尝试在生产环境中运行项目时出错,

运行 npm run build: prod 时编译我没有错误,但运行 npm run server: prod 时通过:

C:\Users\Prueba Tecnica\Venfi> npm run server:prod

> venfi@3.3.0 server:prod C:\Users\Prueba Tecnica\Venfi
> http-server dist --cors

events.js:160
  throw er; // Unhandled 'error' event
  ^

Error: listen EADDRINUSE 0.0.0.0: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 _combinedTickCallback (internal/process/next_tick.js:77:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "server:prod"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! venfi@3.3.0 server:prod: `http-server dist --cors`
npm ERR! Exit status 1 
npm ERR!
npm ERR! Failed at the venfi@3.3.0 server:prod script 'http-server dist --cors'.
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 venfi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     http-server dist --cors
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs venfi
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls venfi
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Prueba Tecnica\Venfi\npm-debug.log

感谢您的帮助。

【问题讨论】:

    标签: javascript node.js angular express npm


    【解决方案1】:

    端口已在使用中。只需在您所在的任何操作系统上打开您的任务管理器并终止任何节点进程。当使用 cli 中的节点内容时,请记住在运行时按 ctrl + c 来终止进程。有时,如果您只是使用 X 按钮关闭终端,它将关闭终端,但让进程在后台运行。如果所有其他方法都失败并且您无法摆脱该消息,请重新启动计算机。

    【讨论】:

      【解决方案2】:

      这不是节点 JS 错误, 端口 8080 上已经有东西在运行。

      杀死它并再次运行它。! 杀死端口上的进程的步骤。

      1. 键入 netstat -a -o -n 会弹出一个网络列表,查看 PID(例如 8080)。

      2 .为了找出 PID 8080 是什么(希望不是木马),我输入了 tasklist /FI “PID eq 8080”

      1. 要杀死它,请键入 taskkill /F /PID 2600 [无论我在上述步骤中得到什么 processId。]

      【讨论】:

        猜你喜欢
        • 2019-04-14
        • 2019-01-09
        • 1970-01-01
        • 2017-08-01
        • 2017-12-25
        • 1970-01-01
        • 2021-03-03
        • 2021-07-14
        • 2019-07-11
        相关资源
        最近更新 更多