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

SUDO NPM Install is erroring and NPM is not installing please help



  • Hello all,

    I am working on a Mac Mini running macOS 10.13.3. I would like to replicate the AI Smart Mirror in this youtube video. The project’s step by step can be found here.

    I have been unsuccessful in my attempts start the Magic Mirror after running the npm start command. I believe it is because npm has failed to install when i run the sudo npm install command.

    This is the syntax i receive when i run sudo npm install is:
    Davids-Mac-mini:MagicMirror davidshaw$ sudo npm install
    Password:

    > electron-chromedriver@1.7.1 install /Users/davidshaw/MagicMirror/node_modules/spectron/node_modules/electron-chromedriver
    > node ./download-chromedriver.js
    
    /Users/davidshaw/MagicMirror/node_modules/spectron/node_modules/electron-chromedriver/download-chromedriver.js:19
        if (error != null) throw error
                           ^
    
    Error: EACCES: permission denied, mkdir '/Users/davidshaw/MagicMirror/node_modules/spectron/node_modules/electron-chromedriver/bin'
    npm WARN grunt-stylelint@0.10.0 requires a peer of stylelint@^9.0.0 but none is installed. You must install peer dependencies yourself.
    
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! electron-chromedriver@1.7.1 install: `node ./download-chromedriver.js`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the electron-chromedriver@1.7.1 install 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!     /Users/davidshaw/.npm/_logs/2018-04-05T03_22_18_595Z-debug.log
    Davids-Mac-mini:MagicMirror davidshaw$ 
    
    

    The syntax i receive when running the npm start is:

    npm ERR! path /Users/davidshaw/.npm/_logs/2018-04-05T01_43_20_856Z-debug.log
    npm ERR! code EACCES
    npm ERR! errno -13
    npm ERR! syscall unlink
    npm ERR! Error: EACCES: permission denied, unlink '/Users/davidshaw/.npm/_logs/2018-04-05T01_43_20_856Z-debug.log'
    npm ERR!     at Object.fs.unlinkSync (fs.js:1078:18)
    npm ERR!     at Function.rimrafSync [as sync] (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:306:17)
    npm ERR!     at /usr/local/lib/node_modules/npm/lib/npm.js:328:20
    npm ERR!     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
    npm ERR!     at Glob. (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:151:7)
    npm ERR!     at Glob.emit (events.js:180:13)
    npm ERR!     at Glob._finish (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:197:8)
    npm ERR!     at done (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:182:14)
    npm ERR!     at Glob._processReaddir2 (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:434:12)
    npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:371:17
    npm ERR!     at RES (/usr/local/lib/node_modules/npm/node_modules/inflight/inflight.js:31:16)
    npm ERR!     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
    npm ERR!     at Glob._readdirEntries (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:578:10)
    npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:555:12
    npm ERR!     at go$readdir$cb (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:149:14)
    npm ERR!     at FSReqWrap.oncomplete (fs.js:153:20)
    npm ERR!  { Error: EACCES: permission denied, unlink '/Users/davidshaw/.npm/_logs/2018-04-05T01_43_20_856Z-debug.log'
    npm ERR!     at Object.fs.unlinkSync (fs.js:1078:18)
    npm ERR!     at Function.rimrafSync [as sync] (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:306:17)
    npm ERR!     at /usr/local/lib/node_modules/npm/lib/npm.js:328:20
    npm ERR!     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
    npm ERR!     at Glob. (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:151:7)
    npm ERR!     at Glob.emit (events.js:180:13)
    npm ERR!     at Glob._finish (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:197:8)
    npm ERR!     at done (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:182:14)
    npm ERR!     at Glob._processReaddir2 (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:434:12)
    npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:371:17
    npm ERR!     at RES (/usr/local/lib/node_modules/npm/node_modules/inflight/inflight.js:31:16)
    npm ERR!     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
    npm ERR!     at Glob._readdirEntries (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:578:10)
    npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:555:12
    npm ERR!     at go$readdir$cb (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:149:14)
    npm ERR!     at FSReqWrap.oncomplete (fs.js:153:20)
    npm ERR!   stack: 'Error: EACCES: permission denied, unlink \'/Users/davidshaw/.npm/_logs/2018-04-05T01_43_20_856Z-debug.log\'\n    at Object.fs.unlinkSync (fs.js:1078:18)\n    at Function.rimrafSync [as sync] (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:306:17)\n    at /usr/local/lib/node_modules/npm/lib/npm.js:328:20\n    at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)\n    at Glob. (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:151:7)\n    at Glob.emit (events.js:180:13)\n    at Glob._finish (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:197:8)\n    at done (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:182:14)\n    at Glob._processReaddir2 (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:434:12)\n    at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:371:17\n    at RES (/usr/local/lib/node_modules/npm/node_modules/inflight/inflight.js:31:16)\n    at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)\n    at Glob._readdirEntries (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:578:10)\n    at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:555:12\n    at go$readdir$cb (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:149:14)\n    at FSReqWrap.oncomplete (fs.js:153:20)',
    npm ERR!   errno: -13,
    npm ERR!   code: 'EACCES',
    npm ERR!   syscall: 'unlink',
    npm ERR!   path: '/Users/davidshaw/.npm/_logs/2018-04-05T01_43_20_856Z-debug.log' }
    npm ERR! 
    npm ERR! Please try running this command again as root/Administrator.
    
    > magicmirror@2.3.1 start /Users/davidshaw/MagicMirror
    > sh run-start.sh
    
    /Users/davidshaw/MagicMirror/node_modules/electron/index.js:9
      throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
      ^
    
    Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
        at Object. (/Users/davidshaw/MagicMirror/node_modules/electron/index.js:9:9)
        at Module._compile (internal/modules/cjs/loader.js:654:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
        at Module.load (internal/modules/cjs/loader.js:566:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
        at Function.Module._load (internal/modules/cjs/loader.js:498:3)
        at Module.require (internal/modules/cjs/loader.js:598:17)
        at require (internal/modules/cjs/helpers.js:11:18)
        at Object. (/Users/davidshaw/MagicMirror/node_modules/electron/cli.js:3:16)
        at Module._compile (internal/modules/cjs/loader.js:654:30)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! magicmirror@2.3.1 start: `sh run-start.sh`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the magicmirror@2.3.1 start script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    Davids-Mac-mini:MagicMirror davidshaw$ 
    
    

    The syntax i receive when runnig sudo npm start is:

    path.js:1087
              cwd = process.cwd();
                            ^
    
    Error: ENOENT: no such file or directory, uv_cwd
        at Object.resolve (path.js:1087:25)
        at Function.Module._resolveLookupPaths (internal/modules/cjs/loader.js:435:17)
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:542:20)
        at Function.Module._load (internal/modules/cjs/loader.js:475:25)
        at Module.require (internal/modules/cjs/loader.js:598:17)
        at require (internal/modules/cjs/helpers.js:11:18)
        at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
        at Object. (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
        at Module._compile (internal/modules/cjs/loader.js:654:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    Davids-Mac-mini:MagicMirror davidshaw$ sudo npm start
    path.js:1087
              cwd = process.cwd();
                            ^
    
    Error: ENOENT: no such file or directory, uv_cwd
        at Object.resolve (path.js:1087:25)
        at Function.Module._resolveLookupPaths (internal/modules/cjs/loader.js:435:17)
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:542:20)
        at Function.Module._load (internal/modules/cjs/loader.js:475:25)
        at Module.require (internal/modules/cjs/loader.js:598:17)
        at require (internal/modules/cjs/helpers.js:11:18)
        at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
        at Object. (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
        at Module._compile (internal/modules/cjs/loader.js:654:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    

    I have tried manually downloading and installing the latest version Node.js
    I have tried running npm update.
    I have tried deleting the Magic Mirror and then re-cloning it to my Mac
    I have tried to change permission with sudo chown nobody

    If anyone can assist on what to do from here I will greatly appreciate it. Thank you