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 is giving Error.

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    18 Posts 11 Posters 29.7k Views 11 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.
    • P Offline
      postremalone
      last edited by

      NPM install is giving error.

      alt text

      Help please.

      P 1 Reply Last reply Reply Quote 0
      • A Offline
        alessandroiacovella
        last edited by

        same with me :pouting_face:

        1 Reply Last reply Reply Quote 0
        • M Offline
          merceg100
          last edited by

          Same here:

          Same here:

          pi@raspberrypi:~/MagicMirror $ npm install
          (node:4024) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
          npm ERR! Error: Method Not Allowed
          npm ERR! at errorResponse (/usr/share/npm/lib/cache/add-named.js:260:10)
          npm ERR! at /usr/share/npm/lib/cache/add-named.js:203:12
          npm ERR! at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:167:7)
          npm ERR! at FSReqWrap.oncomplete (fs.js:135:15)
          npm ERR! If you need help, you may report this entire log,
          npm ERR! including the npm and node versions, at:
          npm ERR! http://github.com/npm/npm/issues

          npm ERR! System Linux 4.14.52-v7+
          npm ERR! command “/usr/bin/node” “/usr/bin/npm” “install”
          npm ERR! cwd /home/pi/MagicMirror
          npm ERR! node -v v8.11.1
          npm ERR! npm -v 1.4.21
          npm ERR! code E405
          npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.

          electron-chromedriver@1.7.1 install /home/pi/MagicMirror/node_modules/spectron/node_modules/electron-chromedriver
          node ./download-chromedriver.js

          npm ERR! fetch failed https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz
          npm WARN engine rxjs@5.5.11: wanted: {“npm”:“>=2.0.0”} (current: {“node”:“8.11.1”,“npm”:“1.4.21”})
          npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
          npm ERR! fetch failed https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz
          npm ERR!
          npm ERR! Additional logging details can be found in:
          npm ERR! /home/pi/MagicMirror/npm-debug.log
          npm ERR! not ok code 0

          N 1 Reply Last reply Reply Quote 0
          • N Offline
            NoNameRo @merceg100
            last edited by NoNameRo

            @postremalone @alessandroiacovella @merceg100

            Upgrade npm with

            npm install -g npm@latest
            
            M 1 Reply Last reply Reply Quote 0
            • A Offline
              alessandroiacovella
              last edited by

              What command do you type to upgrade npm?

              1 Reply Last reply Reply Quote 0
              • M Offline
                merceg100 @NoNameRo
                last edited by

                @nonamero said in NPM install is giving Error.:

                @postremalone @alessandroiacovella @merceg100

                Upgrade npm with

                npm install -g npm@latest
                

                Tried it… doesn’t help either…

                1 Reply Last reply Reply Quote 0
                • P Offline
                  postremalone
                  last edited by

                  Bump… Anyone help please.

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    merceg100
                    last edited by

                    @alessandroiacovella said in NPM install is giving Error.:

                    What command do you type to upgrade npm?

                    After I installed MM using this command:
                    git clone https://github.com/MichMich/MagicMirror

                    then I ran:
                    sudo apt-get install npm

                    afterwards:
                    cd MagicMirror

                    npm install

                    Then I tried

                    npm install -g npm@latest

                    but it didnt work also.
                    I am running latest updated Raspbian on RPi 3 b+

                    N 1 Reply Last reply Reply Quote 0
                    • N Offline
                      NoNameRo @merceg100
                      last edited by NoNameRo

                      @merceg100

                      please try the following

                      sudo apt-get remove nodejs nodejs-legacy nodered
                      

                      after that

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

                      after that enter in the repository with

                      cd MagicMirror
                      

                      then install and run the app with

                      npm install && npm start
                      

                      in case of errors please post here.

                      why do not you use the automatic installation for the RPi 3 b +

                      bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"
                      
                      D D 2 Replies Last reply Reply Quote 0
                      • F Offline
                        fire1ce
                        last edited by

                        @nonamero

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

                        won’t install npm. getting command not found: npm

                        N 1 Reply Last reply Reply Quote 0
                        • N Offline
                          NoNameRo @fire1ce
                          last edited by

                          @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
                          
                          F 1 Reply Last reply Reply Quote 0
                          • F Offline
                            fire1ce @NoNameRo
                            last edited by

                            @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.

                            1 Reply Last reply Reply Quote 0
                            • D Offline
                              dnwmhaha @NoNameRo
                              last edited by

                              @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:~ $ 
                              
                              
                              
                              
                              1 Reply Last reply Reply Quote 0
                              • A Offline
                                Alex_
                                last edited by

                                @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
                                
                                1 Reply Last reply Reply Quote 0
                                • E Offline
                                  epi
                                  last edited by

                                  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
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • D Offline
                                    devinhedge @NoNameRo
                                    last edited by

                                    @nonamero I’ve brought this up on another thread, but I’ll mention here so that it is captured in context: for the last couple months Node.js and npm are currently BROKEN on RaspberryPi.

                                    I just tried a test this morning using the started Electron app at https://electronjs.org/docs/tutorial/first-app

                                    Running the automated install is a Red Herring. It is inappropriate to suggest it.

                                    We have to figure out how to fix the bugs in the Node.js installation for Raspberry Pi before anything else. I’m wondering if installing an older version of Node.js is the solution. If so, then what version would we start with?

                                    1 Reply Last reply Reply Quote 0
                                    • P Offline
                                      paddyhughes @postremalone
                                      last edited by

                                      @postremalone

                                      I just installed a module and it asked me to update NPM think i did it in the root directory not MagicMirror one can be sure.

                                      This is what worked for me
                                      sudo npm i -g npm

                                      1 Reply Last reply Reply Quote 0
                                      • R Offline
                                        rmeskill
                                        last edited by

                                        Aha-got it!

                                        sudo rm -rf ~/.nvm
                                        sudo rm /usr/local/bin/node
                                        sudo rm /usr/local/bin/nvm
                                        pm2 stop mm (not sure if I missed this earlier)
                                        bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"
                                        

                                        This installed fine, but gave me an error of an out-of-date npm version, so I ran:

                                        sudo npm i -g npm
                                        

                                        Then moved all my old modules and config file over to the new install and checked my node/npm versions:

                                        pi@raspberrypi:~/MagicMirrorBackup/modules $ node -v
                                        v9.11.2
                                        pi@raspberrypi:~/MagicMirrorBackup/modules $ npm -v
                                        6.5.0
                                        

                                        So they’re not as up-to-date as my previous ones, but MagicMirror is working fine!

                                        Thanks everyone for the input, turns out just a bit of manual removal and persistence sorted me out!

                                        1 Reply Last reply Reply Quote 1

                                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                        With your input, this post could be even better 💗

                                        Register Login
                                        • 1 / 1
                                        • First post
                                          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