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

NPM install is giving Error.



  • @fire1ce

    try

    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    sudo apt-get install -y nodejs
    npm install -g npm@latest
    


  • @nonamero said in NPM install is giving Error.:

    @fire1ce

    try

    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    sudo apt-get install -y nodejs
    npm install -g npm@latest
    

    thanks. that helps.



  • @nonamero

    Hi, Thank you for your help. I have been trying to install MM. At first, I had a trouble installing electron and node. Now I got dependencies error.

    I’ve tried what you suggested and I got the following error.

    During the installation of MM, I got Unable to install dependencies!.

    Could you please help?

    //your code here
    pi@raspberrypi:~ $ bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"
    
    $$\      $$\                     $$\           $$\      $$\ $$\                                          $$$$$$\
    $$$\    $$$ |                    \__|          $$$\    $$$ |\__|                                        $$  __$$\
    $$$$\  $$$$ | $$$$$$\   $$$$$$\  $$\  $$$$$$$\ $$$$\  $$$$ |$$\  $$$$$$\   $$$$$$\   $$$$$$\   $$$$$$\  \__/  $$ |
    $$\$$\$$ $$ | \____$$\ $$  __$$\ $$ |$$  _____|$$\$$\$$ $$ |$$ |$$  __$$\ $$  __$$\ $$  __$$\ $$  __$$\  $$$$$$  |
    $$ \$$$  $$ | $$$$$$$ |$$ /  $$ |$$ |$$ /      $$ \$$$  $$ |$$ |$$ |  \__|$$ |  \__|$$ /  $$ |$$ |  \__|$$  ____/
    $$ |\$  /$$ |$$  __$$ |$$ |  $$ |$$ |$$ |      $$ |\$  /$$ |$$ |$$ |      $$ |      $$ |  $$ |$$ |      $$ |
    $$ | \_/ $$ |\$$$$$$$ |\$$$$$$$ |$$ |\$$$$$$$\ $$ | \_/ $$ |$$ |$$ |      $$ |      \$$$$$$  |$$ |      $$$$$$$$\
    \__|     \__| \_______| \____$$ |\__| \_______|\__|     \__|\__|\__|      \__|       \______/ \__|      \________|
                           $$\   $$ |
                           \$$$$$$  |
                            \______/
    
    Updating packages ...
    Hit:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease
    Get:2 http://archive.raspberrypi.org/debian stretch InRelease [25.3 kB]
    Hit:3 https://deb.nodesource.com/node_8.x stretch InRelease    
    Fetched 25.3 kB in 1s (13.7 kB/s)
    Reading package lists... Done
    Installing helper tools ...
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    build-essential is already the newest version (12.3).
    curl is already the newest version (7.52.1-5+deb9u6).
    git is already the newest version (1:2.11.0-3+deb9u3).
    unzip is already the newest version (6.0-21).
    wget is already the newest version (1.18-5+deb9u2).
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Check current Node installation ...
    Node currently installed. Checking version number.
    Minimum Node version: v5.1.0
    Installed Node version: v5.7.0
    No Node.js upgrade necessary.
    Cloning MagicMirror ...
    Cloning into 'MagicMirror'...
    remote: Counting objects: 276, done.
    remote: Compressing objects: 100% (245/245), done.
    remote: Total 276 (delta 34), reused 129 (delta 21), pack-reused 0
    Receiving objects: 100% (276/276), 383.32 KiB | 688.00 KiB/s, done.
    Resolving deltas: 100% (34/34), done.
    Cloning MagicMirror Done!
    Installing dependencies ...
    /home/pi/.nvm/versions/node/v5.7.0/lib/node_modules/npm/bin/npm-cli.js:82
          let notifier = require('update-notifier')({pkg})
          ^^^
    
    SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
        at exports.runInThisContext (vm.js:53:16)
        at Module._compile (module.js:387:25)
        at Object.Module._extensions..js (module.js:422:10)
        at Module.load (module.js:357:32)
        at Function.Module._load (module.js:314:12)
        at Function.Module.runMain (module.js:447:10)
        at startup (node.js:141:18)
        at node.js:933:3
    Unable to install dependencies!
    pi@raspberrypi:~ $ 
    
    
    
    


  • @postremalone said in NPM install is giving Error.:

    NPM install is giving error.

    alt text

    Help please.

    I meet the same issue than you and I solved it by uninstalling nodejs

    sudo apt-get remove nodejs
    

    and reinstall nodejs by using the MagicMirror install script

    bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"
    

    During the installation, npm install -g npm@latest give me this error

    npm ERR! path /usr/lib/node_modules/npm/node_modules/ansi-regex
    npm ERR! code EACCES
    npm ERR! errno -13
    npm ERR! syscall access
    npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/npm/node_modules/ansi-regex'
    npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules/npm/node_modules/ansi-regex'
    npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules/npm/node_modules/ansi-regex\'',
    npm ERR!   errno: -13,
    npm ERR!   code: 'EACCES',
    npm ERR!   syscall: 'access',
    npm ERR!   path: '/usr/lib/node_modules/npm/node_modules/ansi-regex' }
    npm ERR!
    npm ERR! Please try running this command again as root/Administrator.
    
    

    and I run same command as root to solved this

    sudo npm install -g npm@latest
    

    Here is version of nodejs install by MagicMirror script :

    Installed Node version: v9.11.2
    


  • pi@raspberrypi:~/MagicMirror $ npm start
    
    > magicmirror@2.4.1 start /home/pi/MagicMirror
    > sh run-start.sh
    
    /home/pi/MagicMirror/node_modules/electron/index.js:1
    (function (exports, require, module, __filename, __dirname) {
    
    
    SyntaxError: Invalid or unexpected token
        at new Script (vm.js:51:7)
        at createScript (vm.js:136:10)
        at Object.runInThisContext (vm.js:197:10)
        at Module._compile (internal/modules/cjs/loader.js:618:28)
        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)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! magicmirror@2.4.1 start: `sh run-start.sh`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the magicmirror@2.4.1 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-09-13T10_40_56_673Z-debug.log