MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

Error - EADDRINUSE



  • Hi everyone, I’m new to MM and coding.

    Situation - when I ran , I received an odd note in my terminal (copied the below from Google).

    Error: listen EADDRINUSE: address already in use :::8080
        at Server.setupListenHandle [as _listen2] (net.js:1258:14)
        at listenInCluster (net.js:1306:12)
        at Server.listen (net.js:1394:7)
    

    I found some instructions online and then KILLED something in the terminal (again copied from Google):

    node 2464 murari 21u IPv6 4392639 0t0 TCP *:http-alt

    So I killed MY PID which was a different number and I’ve sort of fucked up my MM.

    When I run the MM, I receive this error now - could someone please help? Thank you Xx

    code: 'EADDRINUSE',
      errno: 'EADDRINUSE',
      syscall: 'listen',
      address: '[deleted]',
      port: 8080
    }
    [2020-07-26 09:30:22.750] [ERROR]  MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    [2020-07-26 09:30:22.750] [ERROR]  If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    [2020-07-26 09:30:22.780] [LOG]    Launching application.
    ^C
    


  • @Ice-cream

    if u reboot, does mm start?

    how did u install? the automated script? if so, did u say yes to “use pm2 to autostart”?

    maybe do

    pm2 status
    

    otherwise some other app is using the same port as mm wants to use.

    edit config.js, and change

    port:8080, 
    

    to

    port:8090,
    


  • Sorry, that did not work - error I receive.
    code: ‘EADDRINUSE’,
    errno: ‘EADDRINUSE’,
    syscall: ‘listen’,
    address: ‘[delete]’,
    port: 8090

    Yes MM auto-starts on reboot > yes to automated script > I followed these steps: https://github.com/MichMich/MagicMirror/wiki/Auto-Starting-MagicMirror.

    The current error when I run

    pm2 restart mm
    

    Use --update-env to update environment variables
    [PM2] Applying action restartProcessId on app [mm](ids: 0,1)
    [PM2] mm â
    [PM2] mm â
    ââââââ¬âââââââââââââââââââââ¬âââââââââââ¬âââââââ¬ââââââââââââ¬âââââââââââ¬âââââââââââ
    â id â name â mode â ⺠â status â cpu â memory â
    ââââââ¼âââââââââââââââââââââ¼âââââââââââ¼âââââââ¼ââââââââââââ¼âââââââââââ¼âââââââââââ¤
    â 0 â mm â fork â 0 â errored â 0% â 0b â
    â 1 â mm â fork â 1 â online â 0% â 1.8mb â
    ââââââ´âââââââââââââââââââââ´âââââââââââ´âââââââ´ââââââââââââ´âââââââââââ´âââââââââââ

    I’ve also run

    pm2 logs mm
    

    pi@raspberrypi:~ $ pm2 logs mm
    [TAILING] Tailing last 15 lines for [mm] process (change the value with --lines option)
    /home/pi/.pm2/logs/mm-error.log last 15 lines:
    0|mm | npm ERR! Failed at the magicmirror@2.12.0 start script.
    0|mm | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    0|mm |
    0|mm | npm ERR! A complete log of this run can be found in:
    0|mm | npm ERR! /home/pi/.npm/_logs/2020-07-26T00_13_44_413Z-debug.log
    0|mm | npm ERR! code ELIFECYCLE
    0|mm | npm ERR! errno 1
    0|mm | npm ERR! magicmirror@2.12.0 start: DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js
    0|mm | npm ERR! Exit status 1
    0|mm | npm ERR!
    0|mm | npm ERR! Failed at the magicmirror@2.12.0 start script.
    0|mm | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    0|mm |
    0|mm | npm ERR! A complete log of this run can be found in:
    0|mm | npm ERR! /home/pi/.npm/_logs/2020-07-26T00_36_04_600Z-debug.log

    I’ve just checked and I do not have a doc electron.js from this source - ./node_modules/.bin/electron js/electron.js.

    I remember that all I did was type kill in the terminal and killed a number - what mess have I caused!!! I’m so sorry 😞

    The instructions I followed - I stopped after I entered kill and the number (I think mine began with a 5 or 9)



  • @Ice-cream can u show me the top of config.js and show me how u start magic mirror



  • @sdetweil

    config = {
    	address: "localhost", 	// Address to listen on, can be:
    							// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
    							// - another specific IPv4/6 to listen on a specific interface
    							// - "0.0.0.0", "::" to listen on any interface
    							// Default, when address config is left out or empty, is "localhost"
    	port: 8090,
    	basePath: "/", 	// The URL path where MagicMirror is hosted. If you are using a Reverse proxy
    					// you must set the sub path here. basePath must end with a /
    	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], 	// Set [] to allow all IP addresses
    															// or add a specific IPv4 of 192.168.1.5 :
    															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
    															// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
    															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
    
    	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
    	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
    	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true
    


  • @Ice-cream ok, all. makes no sense do

    pm2 stop 0
    reboot
    

    now, system should reboot, and mm should not restart.

    then do

    cd ~/MagicMirror
    npm start >somefile 2>&1
    

    if mm does not start press ctr-c to stop the npm start

    edit the somefile


Log in to reply