Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Auf einmal viele Fehler in den Skripten

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Auf einmal viele Fehler in den Skripten

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

      Hallo,

      ich habe seit langem mal in meine Skripte geschaut, weil ich was anpassen wollten. Die Skripte funktionieren alle wie gehabt. Es werden aber jeder Menge Befehle als Fehler rot unterstrichen.

      Beispiele:

      on('admin.0.info.updatesJson', function(dp) {
          let list = JSON.parse(dp.state.val);
          let adapters = Object.keys(list);
      

      Hier wird JSON als Fehler markiert.
      Cannot find name 'JSON'.

      Gleiches gilt auch für:
      Object
      Math
      String()
      parseInt()
      RegExp()
      new Date()

      Auch werden einige String Funktionen als Fehler markiert:

      function addZigbeeName (sMsg) {
          $('zigbee.0.*.available').each(function (id, i) {
              let dp = id.replace('.available','');
      

      Hier wird replace als Fehler markiert.
      Property 'replace' does not exist on type 'string'.

      Gleiches gilt auch für:
      split
      match

      Werden die Stingfunktionen auf eine Variable vom Typ any angewandt, gibt es keinen Fehler.

      Hat jemand eine Idee was da los ist und wie man das lösen kann? Wie schon gesagt, die Skripte funktionieren.

      paul53 1 Reply Last reply Reply Quote 0
      • paul53
        paul53 @pk68 last edited by

        @pk68 sagte: Befehle als Fehler rot unterstrichen.

        Das kann ich bei mir (Version 7.1.4) nicht nachvollziehen.

        P 2 Replies Last reply Reply Quote 0
        • P
          pk68 @paul53 last edited by

          @paul53
          Danke für die schnelle Rückmeldung. Ich habe auch Version 7.1.4. Weiß allerdings nicht, seit wann das Problem besteht.

          1 Reply Last reply Reply Quote 0
          • P
            pk68 @paul53 last edited by

            @paul53

            Seit dem letzen größeren Update, bekomme ich beim Start des Javescript Adapters einige Fehler:

            2023-10-09 10:53:19.588 - info: javascript.0 (20499) starting. Version 7.1.4 in /opt/iobroker/node_modules/iobroker.javascript, node: v18.17.1, js-controller: 5.0.12
            2023-10-09 10:53:19.648 - info: javascript.0 (20499) npm install color-convert --omit=dev (System call)
            2023-10-09 10:53:26.448 - error: javascript.0 (20499) npm
            2023-10-09 10:53:26.449 - error: javascript.0 (20499) WARN deprecated har-validator@5.1.5: this library is no longer supported
            2023-10-09 10:53:26.670 - error: javascript.0 (20499) npm
            2023-10-09 10:53:26.672 - error: javascript.0 (20499) WARN deprecated node-inspect@2.0.0: This module is part of Node.js core and does not need to be installed separately. It is now unmaintained.
            2023-10-09 10:53:26.878 - error: javascript.0 (20499) npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
            2023-10-09 10:53:27.075 - error: javascript.0 (20499) npm
            2023-10-09 10:53:27.079 - error: javascript.0 (20499) WARN
            2023-10-09 10:53:27.081 - error: javascript.0 (20499) deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
            2023-10-09 10:53:29.964 - info: javascript.0 (20499)
            added 92 packages, and audited 94 packages in 9s
            2023-10-09 10:53:29.966 - info: javascript.0 (20499)
            4 packages are looking for funding
            run `npm fund` for details
            2023-10-09 10:53:29.981 - info: javascript.0 (20499)
            2 moderate severity vulnerabilities
            Some issues need review, and may require choosing
            a different dependency.
            Run `npm audit` for details.
            2023-10-09 10:53:29.984 - error: javascript.0 (20499) npm notice
            npm notice New major version of npm available! 9.6.7 -> 10.2.0
            npm notice Changelog:
            npm notice Run `npm install -g npm@10.2.0` to update!
            npm notice
            2023-10-09 10:53:30.464 - info: javascript.0 (20499) requesting all states
            2023-10-09 10:53:30.466 - info: javascript.0 (20499) requesting all objects
            2023-10-09 10:53:32.025 - info: javascript.0 (20499) received all objects
            2023-10-09 10:53:32.122 - info: javascript.0 (20499) received all states
            

            Sollte ich, wie vorgeschlagen, npm aktualisieren?

            mikeal created this issue in request/request

            open Request’s Past, Present and Future #3142

            amg_666 1 Reply Last reply Reply Quote 0
            • amg_666
              amg_666 @pk68 last edited by

              @pk68 Nach der Antwort von @paul53 wissen wir jetzt, dass du auch 7.1.4 einsetzt. Jetzt fragst du ob du npm aktualisieren sollst, warum postest du nicht mal kurz was du überhaupt einsetzt?
              js-controller, npm version, node.js version das würde es etwas einfacher machen...
              Laut deinem Protokoll hast du npm 9.6.7 und du hast Fehlermeldungen, dass Bibliotheken veraltet sind und nicht mehr unterstützt werden

              2023-10-09 10:53:26.449 - error: javascript.0 (20499) WARN deprecated har-validator@5.1.5: this library is no longer supported
              

              und du hast einen Hinweis, dass deine npm Version veraltet ist

              npm notice New major version of npm available! 9.6.7 -> 10.2.0
              
              npm notice Changelog:
              
              npm notice Run `npm install -g npm@10.2.0` to update!
              

              Also ich würde es updaten 🙂

              P Homoran 2 Replies Last reply Reply Quote 0
              • P
                pk68 @amg_666 last edited by

                @amg_666

                Ich inzwischen etwas im Forum gesucht. Thomas Braun sagt zu dem Befehl

                npm install -g npm@10.2.0
                

                Zitat: "Vergiss den Mist. npm wird nie so angelegt."

                Also fällt das mal aus.

                Hier das Ergebnis des Diagnose-Skripts von Thomas Braun:

                ======================= SUMMARY =======================
                                     v.2023-06-20
                
                
                   Static hostname: raspi4-sh
                         Icon name: computer
                        Machine ID: bd463378997f44f088b185e90db76a13
                           Boot ID: 86891250c2af4485ab914a103b86840e
                  Operating System: Raspbian GNU/Linux 11 (bullseye)
                            Kernel: Linux 6.1.21-v8+
                      Architecture: arm64
                
                Installation:           native
                Kernel:                 aarch64
                Userland:               armhf
                Timezone:               Europe/Berlin (CEST, +0200)
                User-ID:                1000
                X-Server:               false
                Boot Target:            multi-user.target
                
                Pending OS-Updates:     27
                Pending iob updates:    0
                
                Nodejs-Installation:    /usr/bin/nodejs         v18.17.1
                                        /usr/bin/node           v18.17.1
                                        /usr/bin/npm            9.6.7
                                        /usr/bin/npx            9.6.7
                
                Recommended versions are nodejs 18.x.y and npm 9.x.y
                Your nodejs installation is correct
                
                MEMORY:
                               total        used        free      shared  buff/cache   available
                Mem:            3.8G        1.1G        1.9G        0.0K        777M        2.6G
                Swap:            99M          0B         99M
                Total:          3.9G        1.1G        2.0G
                
                Active iob-Instances:   17
                Active repo(s): stable
                
                ioBroker Core:          js-controller           5.0.12
                                        admin                   6.10.1
                
                ioBroker Status:        iobroker is running on this host.
                
                
                Objects type: jsonl
                States  type: jsonl
                
                Status admin and web instance:
                + system.adapter.admin.0                  : admin                 : raspi4-sh                                -  enabled, port: 8081, bind: 192.168.17.202, run as: admin
                + system.adapter.web.0                    : web                   : raspi4-sh                                -  enabled, port: 8082, bind: 192.168.17.202, run as: admin
                
                Objects:                5105
                States:                 4394
                
                Size of iob-Database:
                
                19M     /opt/iobroker/iobroker-data/objects.jsonl
                6.4M    /opt/iobroker/iobroker-data/states.jsonl
                
                
                
                =================== END OF SUMMARY ====================
                
                Thomas Braun 1 Reply Last reply Reply Quote 0
                • Homoran
                  Homoran Global Moderator Administrators @amg_666 last edited by

                  @amg_666 sagte in Auf einmal viele Fehler in den Skripten:

                  Also ich würde es updaten

                  nur wenn du es für deine ganz spezielle Anwendung benötigen würdest!!!
                  ioBroker gehört nicht dazu.

                  @pk68 sagte in Auf einmal viele Fehler in den Skripten:

                  Thomas Braun sagt zu dem Befehl
                  npm install -g npm@10.2.0

                  Zitat: "Vergiss den Mist. npm wird nie so angelegt."

                  vollkommen richtig, da jede Node-Version immer das zu ihr passende npm mitbringt

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

                    @pk68 sagte in Auf einmal viele Fehler in den Skripten:

                    Von einem Update von npm würde ich stark abraten.
                    Allerdings solltest du diese Updates dringend einspielen:

                    Pending OS-Updates: 27

                    Und das nodesource-Repo auf die neue Struktur umstellen. Geht mit dem Skript aus meiner Signatur. (Da kommt dann auch ein update von 'npm' Huckepack mit.)

                    P 1 Reply Last reply Reply Quote 0
                    • P
                      pk68 @Thomas Braun last edited by

                      @thomas-braun

                      Nachdem ich das OS aktualisiert habe, ist das Problem weg. Ist ja krass. Zumal das letzte OS Update erst ca. 10 Tage zurückliegt.
                      Danke für die Hilfe.

                      Sollte ich trotzdem das NodeJS Fixer Skript ausführen? Das Problem ist ja gelöst.

                      P Thomas Braun 2 Replies Last reply Reply Quote 0
                      • P
                        pk68 @pk68 last edited by

                        Achso die Fehlermeldungen, welche beim Start des Javascript-Adapters auftraten (siehe oben), sind nun auch weg.

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

                          @pk68 sagte in Auf einmal viele Fehler in den Skripten:

                          Sollte ich trotzdem das NodeJS Fixer Skript ausführen? Das Problem ist ja gelöst.

                          Ja, wenn das nodesource-Repo noch nicht auf die neue Struktur umgestellt wurde.
                          Kann man u. a. mit

                          apt policy nodejs
                          

                          sehen.

                          Nachdem ich das OS aktualisiert habe, ist das Problem weg. Ist ja krass.

                          Jaja, 'näwah tschänge ä runnink süstäm', oder so.

                          P 1 Reply Last reply Reply Quote 0
                          • P
                            pk68 @Thomas Braun last edited by

                            @thomas-braun

                            Ergebnis apt policy nodejs

                            apt policy nodejs
                            nodejs:
                              Installiert:           18.17.1-deb-1nodesource1
                              Installationskandidat: 18.17.1-deb-1nodesource1
                              Versionstabelle:
                             *** 18.17.1-deb-1nodesource1 500
                                    500 https://deb.nodesource.com/node_18.x bullseye/main armhf Packages
                                    100 /var/lib/dpkg/status
                                 12.22.12~dfsg-1~deb11u4 500
                                    500 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages
                            
                            Thomas Braun 1 Reply Last reply Reply Quote 0
                            • Thomas Braun
                              Thomas Braun Most Active @pk68 last edited by

                              @pk68

                              Ist noch die alte Struktur. Wenn das umgestellt wurde wird da nodejs 18.18.0 in 'nodistro' statt 'bullseye/main' angeboten werden.

                              P 1 Reply Last reply Reply Quote 0
                              • P
                                pk68 @Thomas Braun last edited by

                                @thomas-braun
                                Ok also 'tschänge ä runnink süstäm'. 😧

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

                                  @pk68

                                  Ich würde eher sagen: "Keep your system running by applying updates in time"
                                  Auf Deutsch: Halt die Kiste auf Stand. Immer.

                                  P 1 Reply Last reply Reply Quote 0
                                  • P
                                    pk68 @Thomas Braun last edited by

                                    @thomas-braun sagte in Auf einmal viele Fehler in den Skripten:

                                    Auf Deutsch: Halt die Kiste auf Stand. Immer.

                                    Ich will ja nicht degegen argumentieren, aber manchmal holt man sich durch Updates Probleme rein. Das o.g. Problem hätte ich ohne Update nicht. Vor ein paar Monaten wurde nach Updates der Zigbee-Stick nicht erkannt.

                                    OS Updates mache ich in der Regel aller 2 Monate. Wie oft sollte man dies machen?

                                    Dein Skript habe ich zweimal durchlaufen lassen. Zweimal weil er nach dem ersten einen Neustart gemacht hat. Nach dem zweiten Durchlauf kam 2x "Nothing to do".

                                    Ergebnis apt policy nodejs:

                                    apt policy nodejs
                                    nodejs:
                                      Installiert:           18.18.0-1nodesource1
                                      Installationskandidat: 18.18.0-1nodesource1
                                      Versionstabelle:
                                     *** 18.18.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                            100 /var/lib/dpkg/status
                                         18.17.1-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.17.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.16.1-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.16.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.15.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.14.2-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.14.1-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.14.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.13.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.12.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.11.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.10.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.9.1-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.9.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.8.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.7.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.6.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.5.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.4.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.3.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.2.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.1.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         18.0.0-1nodesource1 1001
                                            500 https://deb.nodesource.com/node_18.x nodistro/main armhf Packages
                                         12.22.12~dfsg-1~deb11u4 500
                                            500 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages
                                    
                                    

                                    Danke für die schnelle Hilfe. 👍

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

                                      @pk68 sagte in Auf einmal viele Fehler in den Skripten:

                                      aber manchmal holt man sich durch Updates Probleme rein.

                                      Dann stimmt deine Basis nicht oder es wird durch das nächste Update gefixt.
                                      Jedenfalls ist ein System 'auf Stand' besser zu unterhalten als ein total versumpftes.

                                      Das o.g. Problem hätte ich ohne Update nicht.

                                      Welches? Das, welches sich durch ein Update in Luft aufgelöst hat?
                                      Damit widersprichst du dir selber.

                                      OS Updates mache ich in der Regel aller 2 Monate. Wie oft sollte man dies machen?

                                      Öfter. Mindestens einmal im Monat, besser noch häufiger.
                                      Und vor einem Posting im Forum bringt man das System ohnehin auf Stand.
                                      Denn einige Probleme erledigen sich von alleine mit aktuellen Versionen.

                                      Nach dem zweiten Durchlauf kam 2x "Nothing to do".

                                      So soll es sein.

                                      P 1 Reply Last reply Reply Quote 0
                                      • P
                                        pk68 @Thomas Braun last edited by

                                        @thomas-braun sagte in Auf einmal viele Fehler in den Skripten:

                                        Welches? Das, welches sich durch ein Update in Luft aufgelöst hat?

                                        Das Problem, das der Javascript-Adapter bestimmte Befehle als Fehler markiert. Als nicht Poweruser kommt man ja nicht darauf, dass dies nicht am Javascript-Adapter sondern am Betriebssystem liegt. Deswegen hatte ich es ja hier gepostet und nicht unter Allgemein.

                                        Und vor einem Posting im Forum bringt man das System ohnehin auf Stand.

                                        Werde ich in Zukunft beherzigen.
                                        Ich mache nach jedem OS Update einen Neustart. Tut das Not?

                                        Thomas Braun OliverIO 2 Replies Last reply Reply Quote 0
                                        • Thomas Braun
                                          Thomas Braun Most Active @pk68 last edited by

                                          @pk68 sagte in Auf einmal viele Fehler in den Skripten:

                                          Tut das Not?

                                          Nein, eigentlich nicht. Das System meldet sich, wenn ein Paket aktualisiert wurde, das einen Neustart erforderlich macht. Das sind aber nichts so furchtbar viele. Service neustarten reicht in der Regel aus. Auf der anderen Seite schadet ein ordentlicher Reboot aber auch nicht.

                                          1 Reply Last reply Reply Quote 0
                                          • OliverIO
                                            OliverIO @pk68 last edited by OliverIO

                                            @pk68

                                            Hast du zusätzliche NPM Pakete in den Einstellungen des JavaScript Adapters eintragen?
                                            Da könnte eventuell der Fehler mit dem har Paket herkommen

                                            Das Problem mit den Unterstrichenenfehlern, ist erst einmal denke ich nur visueller Natur.
                                            Eventuell solltest du mal den Java Skript Adapter komplett neu installieren.
                                            Es sieht so aus, als ob der Editor bestimmte Typ Definitionen nicht findet, anhand eher deinen Code prüft.

                                            Ah Nachtrag, auch der har Fehler war ja nur eine deprecated Warnung.
                                            Das ist erst mal unkritisch. Allerdingss muss man schauen welche Bibliothek da betroffen ist.
                                            Also wenn du selber eine konfiguriert hast, dann musst du die gegen eine aktuellere Version tauschen.
                                            Wenn es aus dem System kommt, dann kümmern sich die Iobroker Entwickler schon
                                            Hier wurde das schon mal behandelt
                                            https://forum.iobroker.net/topic/37632/warn-bei-javascript-adapter-update/7

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            883
                                            Online

                                            31.8k
                                            Users

                                            80.0k
                                            Topics

                                            1.3m
                                            Posts

                                            6
                                            23
                                            946
                                            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