{"id":1362,"date":"2020-05-10T16:29:59","date_gmt":"2020-05-10T16:29:59","guid":{"rendered":"http:\/\/www.dev-metal.ch\/?p=1362"},"modified":"2024-11-01T10:39:01","modified_gmt":"2024-11-01T10:39:01","slug":"iobroker-node-js-update-reinstallation-iobroker","status":"publish","type":"post","link":"https:\/\/www.dev-metal.ch\/?p=1362","title":{"rendered":"ioBroker: Node.js Update \/ Reinstallation ioBroker"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Update 20.2.2024<\/h2>\n\n\n\n<p>Neu ist das Update von node auf dem iobroker deutlich vereinfacht worden. Siehe auch <a rel=\"noreferrer noopener\" href=\"https:\/\/forum.iobroker.net\/topic\/35090\/howto-nodejs-installation-und-upgrades-unter-debian\" data-type=\"link\" data-id=\"https:\/\/forum.iobroker.net\/topic\/35090\/howto-nodejs-installation-und-upgrades-unter-debian\" target=\"_blank\">hier<\/a> und <a rel=\"noreferrer noopener\" href=\"https:\/\/forum.iobroker.net\/topic\/69067\/neuer-befehl-iob-nodejs-update\" data-type=\"link\" data-id=\"https:\/\/forum.iobroker.net\/topic\/69067\/neuer-befehl-iob-nodejs-update\" target=\"_blank\">hier<\/a>:<\/p>\n\n\n\n<p>Siehe auch alle Consolen-Commands f\u00fcr iobroker <a href=\"https:\/\/www.iobroker.net\/docu\/index-400.htm?page_id=6936&amp;lang=en\" data-type=\"link\" data-id=\"https:\/\/www.iobroker.net\/docu\/index-400.htm?page_id=6936&amp;lang=en\" target=\"_blank\" rel=\"noreferrer noopener\">hier<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>iob stop             ## f\u00fcr iob fix muss iobroker gestoppt sein\niob fix\niob nodejs-update xx ## (mit xx eine GERADE Major Node.js version - Ungerade Versionen sind Entwicklerversionen)\nsudo reboot\n\niob upgrade          ## bei Bedarf gleich alle Adapter mit aktualisieren<\/code><\/pre>\n\n\n\n<p>Wenn iobroker als lxc betrieben wird, muss das update-commando als iobroker ausgef\u00fchrt werden:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">su iobroker -s \/bin\/bash -c 'iob nodejs-update 20'<br><br><\/pre>\n\n\n\n<p>Auf dem LXC Container scheint das iobroker update-script nicht zu funktionieren. Also \u00fcber die Pakete installieren:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>NODE_MAJOR=20\n\necho \"deb &#91;signed-by=\/etc\/apt\/keyrings\/nodesource.gpg] https:\/\/deb.nodesource.com\/node_$NODE_MAJOR.x nodistro main\" | sudo tee \/etc\/apt\/sources.list.d\/nodesource.list\n\napt update\n\napt upgrade<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Deprecated:<\/h2>\n\n\n\n<p>Ich betreibe seit einigen Jahren <a rel=\"noopener noreferrer\" href=\"https:\/\/forum.iobroker.net\/\" target=\"_blank\">ioBroker<\/a>, welches auf nodejs basiert. Heute war es an der Zeit die Nodejs Version von 8 auf 12 anzuheben, was leider nicht ganz ohne Probleme funktionierte. Hier fasse ich kurz zusammen, welche Schritte bei meiner Installation n\u00f6tig waren. Die Schritte basieren auf diesem <a rel=\"noopener noreferrer\" href=\"https:\/\/forum.iobroker.net\/topic\/22867\/how-to-node-js-f%C3%BCr-iobroker-richtig-updaten\" target=\"_blank\">Howto.<\/a><\/p>\n\n\n\n<p>Die einzige, im Howto beschriebenen und f\u00fcr mich funktionierende L\u00f6sung f\u00fcr das Update war, die komplette Reinstallation des ioBrokers. Dabei wird zuerst die neue Node.js Version installiert. Dann ein Backup des iobroker-data Verzeichnisses gezogen, die ioBroker-Installation gel\u00f6scht, neu installiert und dann das Backup wieder zur\u00fcck gespielt:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installation neue Node.js Version 12<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"hljs-attribute\">cd \/opt\/iobroker\niobroker<\/span> stop\ncd\n\n# install nodejs\ncurl -sLf https:\/\/deb.nodesource.com\/setup_12.x | sudo -E bash -\nsudo apt-get install -y nodejs\n\n# install iobroker\ncurl -sLf https:\/\/iobroker.net\/install.sh | bash -<\/code><\/pre>\n\n\n\n<p>Bei einer Aktualisierung von Node.js m\u00fcssen bereits installierte JavaScript- Module im ioBroker-Ordner aktualisiert werden, da sonst Fehler bei deren Ausf\u00fchrung auftreten. Hier traten bei mir dann die Probleme auf. Die einzige bei mir funktionierende L\u00f6sung war, den ioBkoker neu zu installieren:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Backup und Neuinstallation ioBroker<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Backup des iobroker-data Verzeichnisses nach &#8222;Home&#8220; ziehen<\/li>\n\n\n\n<li>Die alte Installation l\u00f6schen<\/li>\n\n\n\n<li>ioBroker neu installieren<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"hljs-attribute\">cp<\/span> -r \/opt\/iobroker\/iobroker-data ~\/iobroker-data \nsudo rm -r \/opt\/iobroker\/ \nsudo mkdir \/opt\/iobroker\ncd \/opt\/iobroker\ncurl -sL https:\/\/iobroker.net\/install.sh | bash -<\/code><\/pre>\n\n\n\n<p>ioBroker wird nach der Installation wieder gestartet. Wir stoppen ioBroker deswegen wieder:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"hljs-attribute\">iobroker<\/span> stop<\/code><\/pre>\n\n\n\n<p>Nun l\u00f6schen wir das neu erstellte iobroker-data Verzeichnis und kopieren das Backup<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm -r \/opt\/iobroker\/iobroker-data\ncp -r ~\/iobroker-data \/opt\/iobroker\/iobroker-data<\/code><\/pre>\n\n\n\n<p>W\u00e4hrend meinen Installations-Bem\u00fchungen habe ich festgestellt, dass die Berechtigungen immer wieder durcheinander gehen. Es existiert deswegen ein korrektur-Script, welches die Berechtigungen des ioBrokers wieder gerade zieht. Es ist ratsam dieses jetzt durchzuf\u00fchren:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"hljs-attribute\">cd \/opt\/iobroker\ncurl<\/span> -sL https:\/\/iobroker.net\/fix.sh | bash -<\/code><\/pre>\n\n\n\n<p>Jetzt den ioBroker neu starten<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"hljs-attribute\">iobroker<\/span> start<\/code><\/pre>\n\n\n\n<p>Der Start kann jetzt sehr lange dauern. Der ioBroker merkt jetzt, dass die Adapter (gem. Backup) fehlen und installiert diese neu nach.<\/p>\n\n\n\n<p>Um zu schauen, wo die Installation steht, kann man das log konsultieren<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tail -f \/opt\/iobroker\/log\/iobroker.current.log\n<\/code><\/pre>\n\n\n\n<p>Ein Adapter (zigbee) liess sich jetzt immer noch nicht installieren. Diesen habe ich dann noch manuell installiert:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/opt\/iobroker\niobroker stop\nsudo -H npm install iobroker.zigbee --unsafe-perm<\/code><\/pre>\n\n\n\n<p>Ganz zum Schluss dann nochmals die Berechitigungen gerade ziehen, um sicher zu gehen&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"hljs-attribute\">cd \/opt\/iobroker\ncurl<\/span> -sL https:\/\/iobroker.net\/fix.sh | bash -<\/code><\/pre>\n\n\n\n<p>Das wars. Jetzt den Raspi neu booten und sich \u00fcber die neue ioBroker-Installation freuen \ud83d\ude42<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"hljs-attribute\">sudo reboot<\/span><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Update 20.2.2024 Neu ist das Update von node auf dem iobroker deutlich vereinfacht worden. Siehe auch hier und hier: Siehe auch alle Consolen-Commands f\u00fcr iobroker hier. Wenn iobroker als lxc betrieben wird, muss das update-commando als iobroker ausgef\u00fchrt werden: su iobroker -s \/bin\/bash -c &#8218;iob nodejs-update 20&#8216; Auf dem LXC Container scheint das iobroker update-script [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"no","_lmt_disable":"","footnotes":""},"categories":[10],"tags":[],"class_list":["post-1362","post","type-post","status-publish","format-standard","hentry","category-techdocs"],"modified_by":"ralph","_links":{"self":[{"href":"https:\/\/www.dev-metal.ch\/index.php?rest_route=\/wp\/v2\/posts\/1362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dev-metal.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dev-metal.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dev-metal.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dev-metal.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1362"}],"version-history":[{"count":27,"href":"https:\/\/www.dev-metal.ch\/index.php?rest_route=\/wp\/v2\/posts\/1362\/revisions"}],"predecessor-version":[{"id":2093,"href":"https:\/\/www.dev-metal.ch\/index.php?rest_route=\/wp\/v2\/posts\/1362\/revisions\/2093"}],"wp:attachment":[{"href":"https:\/\/www.dev-metal.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dev-metal.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dev-metal.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}