npm启动vue报错 Error: listen EACCES: permission denied 0.0.0.0:8085

报错日志:

D:\****\***>npm run dev

> [email protected] dev ***
> node --max_old_space_size=4096 build/dev-server.js

。。。。。。
> starting dev server...
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: listen EACCES: permission denied 0.0.0.0:8085
    at Server.setupListenHandle [as _listen2] (net.js:1301:21)
    at listenInCluster (net.js:1366:12)
    at Server.listen (net.js:1452:7)
    at Function.listen (D:\***\***\node_modules\express\lib\application.js:618:24)
    at Object. (D:\***\***\build\dev-server.js:79:22)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
Emitted 'error' event on Server instance at:
    at emitErrorNT (net.js:1345:8)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'EACCES',
  errno: -4092,
  syscall: 'listen',
  address: '0.0.0.0',
  port: 8085
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `node --max_old_space_size=4096 build/dev-server.js`
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.

报错原因:

疑似8085端口已经被占用(平时能够正常启动,当时不清楚什么原因被占用)

解决方案:

1、找到占用8085的程序,并关掉

2、vue框架中配置文件vue.config.js或config/index.js中找到8085端口,改成其他空闲端口

3、如果平时能够正常使用,本次是特殊情况,推荐,重启电脑,首先启动该程序

感想:

本次问题出现后,经查知晓原因后,通过方案1没有查到被占用程序;又因平时使用习惯,方案2不可取;采用方案3时重新后先启动vue程序,在打开IDEA竟然打不开(出现java弹框报错),原来是IDEA内占用端口8085,顿时懵逼,这是以前没出现过的;想想还是按照往常再次重启电脑后,先打开IDEA,再启动VUE程序,又恢复正常;编程一行就是让人这么摸不到头脑,共勉。。。

你可能感兴趣的:(vue,vue.js,npm,javascript)