• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

npm install - electron fails to install

Scheduled Pinned Locked Moved Troubleshooting
7 Posts 3 Posters 3.8k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    antnorwe
    last edited by Mar 10, 2018, 5:26 PM

    Hello!

    I’ve been trying all day to get this set up, I’ve uninstalled and reinstalled it so many times already.

    I see the same issue in both the automated and manual methods.

    When running npm install, the electron install fails due to a permission denied error:

    > uws@0.14.5 install /root/MagicMirror/node_modules/uws
    > node-gyp rebuild > build_log.txt 2>&1 || exit 0
    
    sh: 1: cannot create build_log.txt: Permission denied
    
    > electron-chromedriver@1.7.1 install /root/MagicMirror/node_modules/spectron/node_modules/electron-chromedriver
    > node ./download-chromedriver.js
    
    /root/MagicMirror/node_modules/spectron/node_modules/electron-chromedriver/download-chromedriver.js:16
      if (error != null) throw error
                         ^
    
    Error: EACCES: permission denied, mkdir '/root/MagicMirror/node_modules/spectron/node_modules/electron-chromedriver/.electron'
    [            ......] - install: info lifecycle electron-chromedriver@1.7.1~install: Failed to exec install script
    

    But this is on a brand new directory created during the install process, so not sure how I can resolve that?

    I’m running this using the pi user (as I saw in another thread that using the ‘root’ user can cause issues)

    Thanks!

    1 Reply Last reply Reply Quote 0
    • Y Offline
      yawns Moderator
      last edited by Mar 10, 2018, 7:39 PM

      Your cloned MagicMirror folder resides in /root, but it should be /home/pi

      User pi does not have rights to do much in root folder.

      You are logged in as pi, right?

      Try this please

      cd ~
      git clone https://github.com/MichMich/MagicMirror
      cd ~/MagicMirror
      npm install
      npm start
      
      1 Reply Last reply Reply Quote 1
      • A Offline
        antnorwe
        last edited by antnorwe Mar 11, 2018, 11:04 AM Mar 11, 2018, 9:00 AM

        Thank you! That worked a treat, and made me feel like a numpty :P

        Hopefully a final issue to resolve before I’m up and running, the automated script seems to have completed all tasks successfully, but when I run npm start the start script fails, and I see this in the debug logs:

        0 info it worked if it ends with ok
        1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'start', 'debug' ]
        2 info using npm@5.7.1
        3 info using node@v9.8.0
        4 verbose run-script [ 'prestart', 'start', 'poststart' ]
        5 info lifecycle magicmirror@2.2.2~prestart: magicmirror@2.2.2
        6 info lifecycle magicmirror@2.2.2~start: magicmirror@2.2.2
        7 verbose lifecycle magicmirror@2.2.2~start: unsafe-perm in lifecycle true
        8 verbose lifecycle magicmirror@2.2.2~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/MagicMirror/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
        9 verbose lifecycle magicmirror@2.2.2~start: CWD: /home/pi/MagicMirror
        10 silly lifecycle magicmirror@2.2.2~start: Args: [ '-c', 'sh run-start.sh "debug"' ]
        11 silly lifecycle magicmirror@2.2.2~start: Returned: code: 1  signal: null
        12 info lifecycle magicmirror@2.2.2~start: Failed to exec start script
        13 verbose stack Error: magicmirror@2.2.2 start: `sh run-start.sh "debug"`
        13 verbose stack Exit status 1
        13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
        13 verbose stack     at EventEmitter.emit (events.js:180:13)
        13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
        13 verbose stack     at ChildProcess.emit (events.js:180:13)
        13 verbose stack     at maybeClose (internal/child_process.js:936:16)
        13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
        14 verbose pkgid magicmirror@2.2.2
        15 verbose cwd /home/pi/MagicMirror
        16 verbose Linux 4.9.35-v7+
        17 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "start" "debug"
        18 verbose node v9.8.0
        19 verbose npm  v5.7.1
        20 error code ELIFECYCLE
        21 error errno 1
        22 error magicmirror@2.2.2 start: `sh run-start.sh "debug"`
        22 error Exit status 1
        23 error Failed at the magicmirror@2.2.2 start script.
        23 error This is probably not a problem with npm. There is likely additional logging output above.
        24 verbose exit [ 1, true ]
        

        Is this a common error?

        1 Reply Last reply Reply Quote 0
        • M Offline
          mochman Module Developer
          last edited by Mar 11, 2018, 1:32 PM

          Are you running it through an SSH connection? If so, try running DISPLAY=:0 nohup npm start &
          If that works, I recommend using pm2 to automatically start your mirror. You can find the guide to get pm2 to work with here.

          1 Reply Last reply Reply Quote 0
          • A Offline
            antnorwe
            last edited by Mar 11, 2018, 1:34 PM

            Hey Mochman, I get the same error whether running through SSH or on my Pi directly.

            I tested with your command, and the output of the nohup.out file is:

            > magicmirror@2.2.2 start /home/pi/MagicMirror
            > sh run-start.sh
            
            npm ERR! code ELIFECYCLE
            npm ERR! errno 1
            npm ERR! magicmirror@2.2.2 start: `sh run-start.sh`
            npm ERR! Exit status 1
            npm ERR!
            npm ERR! Failed at the magicmirror@2.2.2 start script.
            npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
            
            npm ERR! A complete log of this run can be found in:
            npm ERR!     /home/pi/.npm/_logs/2018-03-11T13_33_02_140Z-debug.log
            

            Thanks!

            1 Reply Last reply Reply Quote 0
            • M Offline
              mochman Module Developer
              last edited by Mar 11, 2018, 9:11 PM

              What’s in that logfile that was created?

              1 Reply Last reply Reply Quote 0
              • A Offline
                antnorwe
                last edited by Mar 12, 2018, 5:51 AM

                Hey, this is the content of the log file:

                0 info it worked if it ends with ok
                1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'start' ]
                2 info using npm@5.7.1
                3 info using node@v9.8.0
                4 verbose run-script [ 'prestart', 'start', 'poststart' ]
                5 info lifecycle magicmirror@2.2.2~prestart: magicmirror@2.2.2
                6 info lifecycle magicmirror@2.2.2~start: magicmirror@2.2.2
                7 verbose lifecycle magicmirror@2.2.2~start: unsafe-perm in lifecycle true
                8 verbose lifecycle magicmirror@2.2.2~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/MagicMirror/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
                9 verbose lifecycle magicmirror@2.2.2~start: CWD: /home/pi/MagicMirror
                10 silly lifecycle magicmirror@2.2.2~start: Args: [ '-c', 'sh run-start.sh' ]
                11 silly lifecycle magicmirror@2.2.2~start: Returned: code: 1  signal: null
                12 info lifecycle magicmirror@2.2.2~start: Failed to exec start script
                13 verbose stack Error: magicmirror@2.2.2 start: `sh run-start.sh`
                13 verbose stack Exit status 1
                13 verbose stack     at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
                13 verbose stack     at EventEmitter.emit (events.js:180:13)
                13 verbose stack     at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
                13 verbose stack     at ChildProcess.emit (events.js:180:13)
                13 verbose stack     at maybeClose (internal/child_process.js:936:16)
                13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
                14 verbose pkgid magicmirror@2.2.2
                15 verbose cwd /home/pi/MagicMirror
                16 verbose Linux 4.9.35-v7+
                17 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "start"
                18 verbose node v9.8.0
                19 verbose npm  v5.7.1
                20 error code ELIFECYCLE
                21 error errno 1
                22 error magicmirror@2.2.2 start: `sh run-start.sh`
                22 error Exit status 1
                23 error Failed at the magicmirror@2.2.2 start script.
                23 error This is probably not a problem with npm. There is likely additional logging output above.
                24 verbose exit [ 1, true ]
                
                
                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  1/7
                  Last post
                Enjoying MagicMirror? Please consider a donation!
                MagicMirror created by Michael Teeuw.
                Forum managed by Sam, technical setup by Karsten.
                This forum is using NodeBB as its core | Contributors
                Contact | Privacy Policy