vue-cli 修改域名后报错

作者:Mins 时间:2021-04-23 分类:技术教程

修改 /config/index.js module.exports.dev.host 以后,执行npm run dev报错,报错信息如下:

$ npm run dev                                                                               
                                                                                            
> mins@1.0.0 dev C:\Users\jy\Desktop\erp                                                    
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js                 
                                                                                            
 10% building modules 2/2 modules 0 activeevents.js:187                                     
      throw er; // Unhandled 'error' event                                                  
      ^                                                                                     
                                                                                            
Error: listen EADDRNOTAVAIL: address not available 104.118.133.208:8080                     
    at Server.setupListenHandle [as _listen2] (net.js:1283:19)                              
    at listenInCluster (net.js:1348:12)                                                     
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1487:7)                            
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:65:10)                           
Emitted 'error' event on Server instance at:                                                
    at emitErrorNT (net.js:1327:8)                                                          
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {                  
  code: 'EADDRNOTAVAIL',                                                                    
  errno: 'EADDRNOTAVAIL',                                                                   
  syscall: 'listen',                                                                        
  address: '104.118.133.208',                                                               
  port: 8080                                                                                
}                                                                                           
npm ERR! code ELIFECYCLE                                                                    
npm ERR! errno 1                                                                            
npm ERR! mins@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.
npm ERR! Exit status 1                                                                      
npm ERR!                                                                                    
npm ERR! Failed at the mins@1.0.0 dev script.                                               
npm ERR! This is probably not a problem with npm. There is likely additional logging output 

修改本地host即可,例如,自定义域名为 xxx.com ,在host里添加一行:

127.0.0.1 xxx.com

保存host,重新执行 npm run dev即可。

本文标签: vue报错

推荐模板
推荐阅读

欢迎登录模板控!

登录代表您已同意模板控《用户协议》并自愿遵守