Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. [gelöst] Installationsproblem bei node-sonos-http-api

    NEWS

    • ioBroker goes Matter ... Matter Adapter in Stable

    • 15. 05. Wartungsarbeiten am ioBroker Forum

    • Monatsrückblick - April 2025

    [gelöst] Installationsproblem bei node-sonos-http-api

    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Heinz53 last edited by Heinz53

      Ich versuche auf meinem Raspi4 das sonos-http-api zu installieren.

      npm audit zeigt nach der Installation und sudo npm audit fix --force noch einige Fehlermeldungen:

      pi@iobroker:~/node-sonos-http-api $ npm audit
      # npm audit report
      
      minimist  <=0.2.3
      Severity: critical
      Prototype Pollution in minimist - https://github.com/advisories/GHSA-vh95-rmgr-6w4m
      Prototype Pollution in minimist - https://github.com/advisories/GHSA-xvch-5gv4-984h
      fix available via `npm audit fix`
      node_modules/minimist
        optimist  >=0.6.0
        Depends on vulnerable versions of minimist
        node_modules/optimist
      
      node-static  *
      Severity: high
      Denial of Service in node-static - https://github.com/advisories/GHSA-8r4g-cg4m-x23c
      node-static and @nubosoftware/node-static vulnerable to Directory Traversal - https://github.com/advisories/GHSA-5g97-whc9-8g7j
      No fix available
      node_modules/node-static
      
      request  *
      Severity: moderate
      Server-Side Request Forgery in Request - https://github.com/advisories/GHSA-p8p7-x288-28g6
      Depends on vulnerable versions of tough-cookie
      No fix available
      node_modules/request
        anesidora  *
        Depends on vulnerable versions of request
        node_modules/anesidora
      
      tough-cookie  <4.1.3
      Severity: moderate
      tough-cookie Prototype Pollution vulnerability - https://github.com/advisories/GHSA-72xf-g2v4-qvf3
      No fix available
      node_modules/tough-cookie
      
      6 vulnerabilities (3 moderate, 1 high, 2 critical)
      
      To address issues that do not require attention, run:
        npm audit fix
      
      Some issues need review, and may require choosing
      a different dependency.
      
      

      Nach einem reboot versuche ich: sudo npm start

      pi@iobroker:~/node-sonos-http-api $ sudo npm start
      
      > sonos-http-api@1.6.9 start
      > node server.js
      
      2023-11-22T13:54:24.718Z INFO Could not find file /home/pi/node-sonos-http-api/settings.json
      2023-11-22T13:54:25.212Z INFO Presets loaded: {
        example: {
          players: [
            { roomName: 'Bathroom', volume: 10 },
            { roomName: 'Kitchen', volume: 10 },
            { roomName: 'Office', volume: 10 },
            { roomName: 'Bedroom', volume: 10 },
            { roomName: 'TV Room', volume: 15 }
          ],
          playMode: { shuffle: true, repeat: 'all', crossfade: false },
          pauseOthers: false
        }
      }
      node:internal/modules/cjs/loader:446
            throw err;
            ^
      
      Error: Cannot find module '/home/pi/node-sonos-http-api/node_modules/request-promise/lib/tp.js'. Please verify that the package.json has a valid "main" entry
          at tryPackage (node:internal/modules/cjs/loader:438:19)
          at Module._findPath (node:internal/modules/cjs/loader:680:18)
          at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
          at Module._load (node:internal/modules/cjs/loader:922:27)
          at Module.require (node:internal/modules/cjs/loader:1143:19)
          at require (node:internal/modules/cjs/helpers:119:18)
          at Object.<anonymous> (/home/pi/node-sonos-http-api/lib/actions/musicSearch.js:2:17)
          at Module._compile (node:internal/modules/cjs/loader:1256:14)
          at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
          at Module.load (node:internal/modules/cjs/loader:1119:32)
          at Module._load (node:internal/modules/cjs/loader:960:12)
          at Module.require (node:internal/modules/cjs/loader:1143:19)
          at require (node:internal/modules/cjs/helpers:119:18)
          at /home/pi/node-sonos-http-api/lib/helpers/require-dir.js:18:8
          at Array.forEach (<anonymous>)
          at module.exports (/home/pi/node-sonos-http-api/lib/helpers/require-dir.js:17:6) {
        code: 'MODULE_NOT_FOUND',
        path: '/home/pi/node-sonos-http-api/node_modules/request-promise/package.json',
        requestPath: 'request-promise'
      }
      
      Node.js v18.18.2
      
      

      Mit meinen Linux Kenntnissen kann ich das Problem nicht lösen.
      Kann mir jemand weiterhelfen?

      1 Reply Last reply Reply Quote 0
      • Thomas Braun
        Thomas Braun Most Active last edited by

        @heinz53

        Recht viel Chaos...
        Und gewöhn dir die Verwendung von sudo ab. Das macht alles kaputt.
        Und auch von npm audit fix lässt man die Finger, insbesondere von --force.

        Was soll das Ziel der Installation sein? Ein Integration in den ioBroker?

        1 Reply Last reply Reply Quote 0
        • H
          Heinz53 last edited by

          Danke für die schnelle Antwort. Ich hatte die Installion bereits vorher ohne sudo mit den gleichen Fehlern versucht. Daher dachte ich sudo könnte helfen...

          Das Ziel ist, die Integration der SONOS in den ioBroker.

          1 Reply Last reply Reply Quote 0
          • Thomas Braun
            Thomas Braun Most Active last edited by

            @heinz53

            Das würde ich anders anfangen.

            Das entsprechende nodemodul würde ich in /usr/local/bin platzieren und das dann per Skript als Service starten lassen. Hier hab mal was sehr ähnliches mit solix2mqtt gemacht:

            https://forum.iobroker.net/topic/69229/anker-adapter/18?_=1700666385246

            1 Reply Last reply Reply Quote 0
            • H
              Heinz53 last edited by

              Dann versuche ich es mal in dem Verzeichnis /usr/local/bin und zwar ohne sudo

              Die Vorlage für die Installation ist auf folgendem link: https://github.com/jishi/node-sonos-http-api/wiki/Step-by-Step---RPi3-Install-of-Sonos-http-api

              pi@iobroker:/usr/local/bin $ git clone https://github.com/jishi/node-sonos-http-api.git
              fatal: could not create work tree dir 'node-sonos-http-api': Permission denied
              

              Was nun???

              Thomas Braun 1 Reply Last reply Reply Quote 0
              • Thomas Braun
                Thomas Braun Most Active @Heinz53 last edited by

                @heinz53 sagte in Installationsproblem bei node-sonos-http-api:

                Was nun???

                🙂 An DER Stelle brauchst du doch sudo, der pi darf da nämlich nicht reinschreiben. Wenn du magst installier ich das heute Abend mal bei mir und schreib es dann hier auf, wie das geht.

                1 Reply Last reply Reply Quote 0
                • H
                  Heinz53 last edited by

                  Das finde ich super! DANKE erst mal....

                  Thomas Braun 1 Reply Last reply Reply Quote 0
                  • Thomas Braun
                    Thomas Braun Most Active @Heinz53 last edited by Thomas Braun

                    @heinz53

                    Los geht's.

                    In deinem Heimverzeichnis:
                    Mit

                    mkdir sonoshttp
                    

                    ein Arbeitsverzeichnis anlegen.

                    cd sonoshttp/
                    git clone https://github.com/jishi/node-sonos-http-api.git
                    cd node-sonos-http-api/
                    npm install --omit=dev
                    cd ..
                    sudo mv node-sonos-http-api /usr/local/bin
                    
                    

                    Startskript anlegen:

                    sudo nano /usr/local/bin/node-sonos-http-api/sonoshttp.sh
                    

                    mit dem Inhalt:

                    #!/bin/bash
                    cd /usr/local/bin/node-sonos-http-api/;
                    npm start;
                    

                    Owner ändern:

                    sudo chown -R iobroker:iobroker /usr/local/bin/node-sonos-http-api
                    
                    sudo chmod 744 /usr/local/bin/node-sonos-http-api/sonoshttp.sh
                    

                    Jetzt per

                    sudo nano /usr/lib/systemd/system/sonoshttp.service
                    

                    eine Datei mit diesem Inhalt anlegen:

                    [Unit]
                    Description=Sonos http API
                    Before=iobroker.service
                    
                    [Service]
                    User=iobroker
                    Group=iobroker
                    ExecStart=/usr/local/bin/node-sonos-http-api/sonoshttp.sh
                    Type=simple
                    # Restart=always
                    
                    
                    [Install]
                    WantedBy=multi-user.target
                    #RequiredBy=network.target
                    

                    Mit

                    sudo systemctl daemon-reload
                    

                    die Service-Datei bekannt machen.
                    Ab jetzt dürfte das Ding beim Systemstart automatisch gestartet werden.
                    Mit

                    sudo systemctl start sonoshttp.service
                    systemctl status sonoshttp.service
                    

                    schauen was da los ist. Sollte dann ungefähr so aussehen:

                    ● sonoshttp.service - Sonos http API
                         Loaded: loaded (/lib/systemd/system/sonoshttp.service; enabled; preset: enabled)
                         Active: active (running) since Thu 2023-11-23 18:37:00 CET; 29min ago
                       Main PID: 269613 (sonoshttp.sh)
                          Tasks: 27 (limit: 8752)
                            CPU: 4.519s
                         CGroup: /system.slice/sonoshttp.service
                                 ├─269613 /bin/bash /usr/local/bin/node-sonos-http-api/sonoshttp.sh
                                 ├─269614 "npm start"
                                 ├─269630 sh -c "node server.js"
                                 └─269631 node server.js
                    

                    Individuelle Einstellungen müssen dann lt. readme wohl noch angelegt werden. Es sollte aber unter
                    die.IP.des.hosts.:5005/
                    die Startseite zu sehen sein:

                    3cf142c6-d336-495f-8846-b6d21e1ea0d4-image.png

                    1 Reply Last reply Reply Quote 0
                    • H
                      Heinz53 last edited by Heinz53

                      Hallo Thomas, ich bin begeistert!
                      Mit deiner Anleitung konnte ich die api aktivieren.

                      In der Anleitung hat sich an zwei Stellen ein Schreibfehler (...apt statt ...api) eingeschlichen

                      1. in Block Arbeitsverzeichnis anlegen
                        sudo mv node-sonos-http-apt /usr/local/bin
                      2. im Block Owner ändern
                        sudo chown -R iobroker:iobroker /usr/local/bin/node-sonos-http-apt

                      Dann hatte ich noch die Fehlermeldung.

                      pi@iobroker:~/sonoshttp $ sudo systemctl start sonoshttp.service
                      pi@iobroker:~/sonoshttp $ systemctl status sonoshttp.service
                      ● sonoshttp.service - Sonos http API
                           Loaded: loaded (/lib/systemd/system/sonoshttp.service; disabled; vendor preset: enabled)
                           Active: failed (Result: exit-code) since Thu 2023-11-23 23:13:29 CET; 3s ago
                          Process: 3655161 ExecStart=/usr/local/bin/node-sonos-http-api/sonoshttp.sh (code=exited, status=1/FAILURE)
                         Main PID: 3655161 (code=exited, status=1/FAILURE)
                              CPU: 3.965s
                      
                      Nov 23 23:13:28 iobroker sonoshttp.sh[3655369]:     playMode: { shuffle: true, repeat: 'all', crossfade: false },
                      Nov 23 23:13:28 iobroker sonoshttp.sh[3655369]:     pauseOthers: false
                      Nov 23 23:13:28 iobroker sonoshttp.sh[3655369]:   }
                      Nov 23 23:13:28 iobroker sonoshttp.sh[3655369]: }
                      Nov 23 23:13:29 iobroker sonoshttp.sh[3655369]: 2023-11-23T22:13:29.588Z ERROR Port 5005 seems to be in use already. Make sure the sonos->
                      Nov 23 23:13:29 iobroker sonoshttp.sh[3655369]:     already running, or that no other server uses that port. You can specify an alternati>
                      Nov 23 23:13:29 iobroker sonoshttp.sh[3655369]:     with property "port" in settings.json
                      Nov 23 23:13:29 iobroker systemd[1]: sonoshttp.service: Main process exited, code=exited, status=1/FAILURE
                      Nov 23 23:13:29 iobroker systemd[1]: sonoshttp.service: Failed with result 'exit-code'.
                      
                      

                      Nach der Änderung des Ports in der settings.js auf den Port 5015 war der Aufruf erfolgreich.

                      pi@iobroker:/usr/local/bin/node-sonos-http-api $ sudo nano settings.js
                      pi@iobroker:/usr/local/bin/node-sonos-http-api $ sudo systemctl start sonoshttp.service
                      pi@iobroker:/usr/local/bin/node-sonos-http-api $ systemctl status sonoshttp.service
                      ● sonoshttp.service - Sonos http API
                           Loaded: loaded (/lib/systemd/system/sonoshttp.service; disabled; vendor preset: enabled)
                           Active: active (running) since Thu 2023-11-23 23:21:47 CET; 25s ago
                         Main PID: 3671575 (sonoshttp.sh)
                            Tasks: 24 (limit: 3933)
                              CPU: 4.416s
                           CGroup: /system.slice/sonoshttp.service
                                   ├─3671575 /bin/bash /usr/local/bin/node-sonos-http-api/sonoshttp.sh
                                   ├─3671576 npm start
                                   ├─3671610 sh -c node server.js
                                   └─3671611 node server.js
                      
                      Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:       { roomName: 'Kitchen', volume: 10 },
                      Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:       { roomName: 'Office', volume: 10 },
                      Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:       { roomName: 'Bedroom', volume: 10 },
                      Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:       { roomName: 'TV Room', volume: 15 }
                      Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:     ],
                      Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:     playMode: { shuffle: true, repeat: 'all', crossfade: false },
                      Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:     pauseOthers: false
                      Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:   }
                      Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]: }
                      Nov 23 23:21:51 iobroker sonoshttp.sh[3671611]: 2023-11-23T22:21:51.011Z INFO http server listening on 0.0.0.0 port 5015
                      
                      

                      Hast du vielleicht noch einen Vorschlag wie ich feststellen kann was den Port 5005 belegt? Vielleicht habe ich mit meinen vorherigen Versuchen hier etwas durcheinandergebracht.

                      Nochmals: Herzlichen Dank für deine Unterstützung!

                      Thomas Braun 1 Reply Last reply Reply Quote 0
                      • Thomas Braun
                        Thomas Braun Most Active @Heinz53 last edited by Thomas Braun

                        @heinz53 sagte in Installationsproblem bei node-sonos-http-api:

                        Vielleicht habe ich mit meinen vorherigen Versuchen hier etwas durcheinandergebracht.

                        Vermutlich. Im

                        iob diag
                        

                        sind die Serverdienste und deren Ports aber auch drin.

                        1 Reply Last reply Reply Quote 0
                        • H
                          Heinz53 last edited by

                          Danke!
                          Die simple-api.0 ist zugeordnet.

                          Ich lerne dazu, auch Dank deines Werkzeugkastens 👏 👏 👏

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          Support us

                          ioBroker
                          Community Adapters
                          Donate
                          FAQ Cloud / IOT
                          HowTo: Node.js-Update
                          HowTo: Backup/Restore
                          Downloads
                          BLOG

                          723
                          Online

                          31.6k
                          Users

                          79.5k
                          Topics

                          1.3m
                          Posts

                          sonos http api
                          2
                          11
                          525
                          Loading More Posts
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes
                          Reply
                          • Reply as topic
                          Log in to reply
                          Community
                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                          The ioBroker Community 2014-2023
                          logo