NEWS
Node und/oder ioB Experte gesucht
-
Ich suche einen Experten der sich in node und/oder ioB auskennt.
Konkret geht es um ein Phänomen, was im Grunde nur ein Schönheitsfehler ist, was mich aber echt stört.
Ich habe ioB unter Win10 installiert. Immer wenn ich einen neuen Adapter hinzufüge oder einen alten Adapter lösche, werden ALLE Dateien die standartmäßig in den Ordner c:\ioBroker\node_modules.bin\ gehören, in c:\ioBroker\ abgelegt.
Den Ordner c:\ioBroker\node_modules.bin\ gibt es ebenfalls und hier befinden sich die gleichen Dateien drin. Diese Dateien haben allerdings das Datum der Erstinstallation von ioB.
Wie gesagt IMMER wenn ich einen Adapter installiere, oder lösche, werden diese *.bin Dateien ins Hauptverzeichnis von ioB kopiert. Ich kann sie da ohne jegliche Konsequenzen heraus löschen, aber bei der nächsten Bearbeitung eines Adapters sind sie wieder da.
Ich weiß leider überhaupt nicht was bei der Installationsroutine eines Adapters so im Hintergrund passiert. Irgendwo in nodes muss es ja die Aufforderung geben diese Dateien genau dort hin abzulegen.
Weiß jemand wo das ist, wie man da ran kommt und was man ggf. eingeben muss um dieses Zustand zu ändern? Wie gesagt, eigentlich ist es nur "kosmetischer" Natur, aber es "nervt" mich halt.
Wäre schön jemand eine Idee dazu hätte.
-
Hi,
welche node und npm-Version nutzt Du (Kommandozeile)? Bitte auch die npm-Version angeben, die im Admin in der Übersicht steht.
Und was sagt uns die Hilfe?
**Executables
When in global mode, executables are linked into {prefix}/bin on Unix, or directly into {prefix} on Windows.
When in local mode, executables are linked into ./node_modules/.bin so that they can be made available to scripts run through npm.
When installing locally, npm first tries to find an appropriate prefix folder. This is so that npm install foo@1.2.3 will install to the sensible root of your package, even if you happen to have cd-ed into some other folder.
Starting at the $PWD, npm will walk up the folder tree checking for a folder that contains either a package.json file, or a node_modules folder. If such a thing is found, then that is treated as the effective “current directory” for the purpose of running npm commands.
If no package root is found, then the current folder is used.
When you run npm install foo@1.2.3, then the package is loaded into the cache, and then unpacked into ./node_modules/foo. Then, any of foo’s dependencies are similarly unpacked into ./node_modules/foo/node_modules/….
Any bin files are symlinked to ./node_modules/.bin/, so that they may be found by npm scripts when necessary.
** Global Installation
If the global configuration is set to true, then npm will install packages “globally”.
For global installation, packages are installed roughly the same way, but using the folders described above.
Nun, {prefix} ist bei iobroker-Adapterinstallationen der ioBroker-Ordnerpfad. Bleibt die Frage, warum er denkt, dass das was Du da installierst, global ist...
Hast Du in der Vergangenheit irgendwann mal irgendeine Komponente vom ioBroker mit der npm-Option -g oder -global installiert?
Was sagt
npm config ls -g -
System uptime: 29 T. 22:42:42
Node.js: v8.13.0
NPM: 6.4.1
adapters count: 211
` > Und was sagt die Hilfe?
**Executables
When in global mode, executables are linked into {prefix}/bin on Unix, or directly into {prefix} on Windows.
When in local mode, executables are linked into ./node_modules/.bin so that they can be made available to scripts run through npm. `
Sorry, das verstehe ich nicht - wo muss ich da nachgucken?
> Hast Du in der Vergangenheit irgendwann mal irgendeine Komponente vom ioBroker mit der npm-Option -g oder -global installiert?nicht bewusst
Kann man das "pauschal" wieder auf den Ursprungspfad einstellen / rückgängig machen?
Das kommt dabei raus:
C:\WINDOWS\system32>npm config ls -g ; cli configs global = true metrics-registry = "https://registry.npmjs.org/" scope = "" user-agent = "npm/6.4.1 node/v8.13.0 win32 ia32" ; userconfig C:\Users\SmartHome\.npmrc msvs_version = "2017" python = "python2.7" ; builtin config undefined prefix = "C:\\Users\\SmartHome\\AppData\\Roaming\\npm" ; node bin location = C:\Program Files\nodejs\node.exe ; cwd = C:\WINDOWS\system32 ; HOME = C:\Users\SmartHome ; "npm config ls -l" to show all defaults. -
Führe den folgenden Befehl aus:
npm config set global falseDann noch mal mit dem Befehl von vorhin kontrollieren.
Und jetzt einen Adapter installieren und das .bin suchen. ;-)
-
OK - habe ich gemacht - sieht jetzt so aus.
C:\WINDOWS\system32>npm config set global false C:\WINDOWS\system32>npm config ls -g ; cli configs global = true metrics-registry = "https://registry.npmjs.org/" scope = "" user-agent = "npm/6.4.1 node/v8.13.0 win32 ia32" ; userconfig C:\Users\SmartHome\.npmrc msvs_version = "2017" python = "python2.7" ; builtin config undefined prefix = "C:\\Users\\SmartHome\\AppData\\Roaming\\npm" ; node bin location = C:\Program Files\nodejs\node.exe ; cwd = C:\WINDOWS\system32 ; HOME = C:\Users\SmartHome ; "npm config ls -l" to show all defaults.Nach der Installation ist im Hauptverzeichnis nur diese Datei neu erzeugt worden - .npmrc - aber vielleicht gehört die ja sowieso da hin. Habe ich vielleicht immer zuviel gelöscht.
Im regulären *.bin Ordner hat sich an den Dateien nichts geändert (Zeitstempel ist immer noch vom Tag der ersten Installation)
…. aber es sind auch keine neuen Dateien im Hauptverzeichnis abgelegt worden. Der Adapter ist auch regulär im node_modules Ordner angelegt worden.
..... allerdings wurden beim LÖSCHEN des Adapters die *.bin Dateien wieder im Hauptverzeichnis erzeugt.
-
Das global in Deiner Config ist immer noch true. Schau mal, wie du das auf false (ist default so) bringst.
-
ich habe nochmal ins Log geschaut - da bekomme ich diesen Einträge während des löschens.
host.iobroker 2018-12-29 12:28:23.253 error Cannot write files: C:/ioBroker/node_modules/iobroker.js-controller/lib/objects/../../../../iobroker-data/files/mqtt.admin/_data.json: ENOENT: no such file or directory, open 'C:\ioBroker\iobroker-da iobroker 2018-12-29 12:28:23.034 info npm uninstall iobroker.mqtt --silent --save --prefix "C:/ioBroker" (System call) iobroker 2018-12-29 12:28:22.238 info host.iobroker Deleting 1 state(s). iobroker 2018-12-29 12:28:22.238 info host.iobroker Deleting 2 object(s). iobroker 2018-12-29 12:28:22.238 info host.iobroker Counted 1 states (system.adapter.mqtt.*) from states iobroker 2018-12-29 12:28:22.222 info host.iobroker Counted 1 states of mqtt iobroker 2018-12-29 12:28:21.988 info host.iobroker Counted 1 adapters for mqtt iobroker 2018-12-29 12:28:21.972 info host.iobroker no instances of adapter mqtt found iobroker 2018-12-29 12:28:21.956 info Delete adapter "mqtt" iobroker 2018-12-29 12:28:21.550 info del mqtt -
Das global in Deiner Config ist immer noch true. Schau mal, wie du das auf false (ist default so) bringst. `
Könnte in irgendeiner .npmrc-Datei stehen…
-
Habe beim googeln das hier gefunden - beschreibt ziehmlich genau auch mein Problem
Kann ich den Befehl auch verwenden oder zerschieße ich mir dann ggf. etwas?
> I was having a weird issue where things that would usually end up in node_modules/bin were ending up in my project root directory. A simple ****npm config delete prefix**** fixed this for me, thanks! (no idea where the prefix came from)Ich habe nur diese eine npmrc Datei gefunden und da steht lediglich drin:
package-lock=false -
So, habe mich an den Rechner gesetzt und geschaut.
npm config ls -lmüsste unter anderem die folgenden Zeilen ausgeben, oder?
global = false global-style = false globalconfig = "C:\\Users\\<username>\\AppData\\Roaming\\npm\\etc\\npmrc" globalignorefile = "C:\\Users\\<username>\\AppData\\Roaming\\npm\\etc\\npmignore"</username></username>Bei der Installation von iobroker-Adaptern steht doch bei Dir auch in etwa das Folgende?
npm install ...... --prefix "C:/ioBroker" -
Das kommt dabei raus
! C:\WINDOWS\system32>npm config ls -l
! ; cli configs
! long = true
! metrics-registry = "https://registry.npmjs.org/"
! scope = ""
! user-agent = "npm/6.4.1 node/v8.13.0 win32 ia32"
! ; userconfig C:\Users\SmartHome.npmrc
! global = false
! msvs_version = "2017"
! python = "python2.7"
! ; builtin config undefined
! prefix = "C:\Users\SmartHome\AppData\Roaming\npm"
! ; default values
! access = null
! allow-same-version = false
! also = null
! always-auth = false
! audit = true
! audit-level = "low"
! auth-type = "legacy"
! bin-links = true
! browser = null
! ca = null
! cache = "C:\Users\SmartHome\AppData\Roaming\npm-cache"
! cache-lock-retries = 10
! cache-lock-stale = 60000
! cache-lock-wait = 10000
! cache-max = null
! cache-min = 10
! cafile = undefined
! cert = null
! cidr = null
! color = true
! commit-hooks = true
! depth = null
! description = true
! dev = false
! dry-run = false
! editor = "notepad.exe"
! engine-strict = false
! fetch-retries = 2
! fetch-retry-factor = 10
! fetch-retry-maxtimeout = 60000
! fetch-retry-mintimeout = 10000
! force = false
! git = "git"
! git-tag-version = true
! <size size="150">global = false
! global-style = false
! globalconfig = "C:\Users\SmartHome\AppData\Roaming\npm\etc\npmrc"
! globalignorefile = "C:\Users\SmartHome\AppData\Roaming\npm\etc\npmignore"</size>
! group = 0
! ham-it-up = false
! heading = "npm"
! https-proxy = null
! if-present = false
! ignore-prepublish = false
! ignore-scripts = false
! init-author-email = ""
! init-author-name = ""
! init-author-url = ""
! init-license = "ISC"
! init-module = "C:\Users\SmartHome\.npm-init.js"
! init-version = "1.0.0"
! json = false
! key = null
! legacy-bundling = false
! link = false
! local-address = undefined
! loglevel = "notice"
! logs-max = 10
! ; long = false (overridden)
! maxsockets = 50
! message = "%s"
! ; metrics-registry = null (overridden)
! node-options = null
! node-version = "8.13.0"
! noproxy = null
! offline = false
! onload-script = null
! only = null
! optional = true
! otp = null
! package-lock = true
! package-lock-only = false
! parseable = false
! prefer-offline = false
! prefer-online = false
! ; prefix = "C:\Program Files\nodejs" (overridden)
! preid = ""
! production = false
! progress = true
! proxy = null
! read-only = false
! rebuild-bundle = true
! registry = "https://registry.npmjs.org/"
! rollback = true
! save = true
! save-bundle = false
! save-dev = false
! save-exact = false
! save-optional = false
! save-prefix = "^"
! save-prod = false
! scope = ""
! script-shell = null
! scripts-prepend-node-path = "warn-only"
! searchexclude = null
! searchlimit = 20
! searchopts = ""
! searchstaleness = 900
! send-metrics = false
! shell = "C:\WINDOWS\system32\cmd.exe"
! shrinkwrap = true
! sign-git-commit = false
! sign-git-tag = false
! sso-poll-frequency = 500
! sso-type = "oauth"
! strict-ssl = true
! tag = "latest"
! tag-version-prefix = "v"
! timing = false
! tmp = "C:\Users\SMARTH~1\AppData\Local\Temp"
! umask = 0
! unicode = false
! unsafe-perm = true
! update-notifier = true
! usage = false
! user = 0
! ; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch}" (overridden)
! userconfig = "C:\Users\SmartHome\.npmrc"
! version = false
! versions = false
! viewer = "browser"….. und das kommt bei npm install..... --prefix raus
C:\WINDOWS\system32>npm install ...... --prefix npm WARN invalid config prefix=true npm WARN invalid config Must be a valid filesystem path npm ERR! code ENOLOCAL npm ERR! Could not install from "......" as it does not contain a package.json file. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\SmartHome\AppData\Roaming\npm-cache\_logs\2018-12-29T13_00_44_292Z-debug.log -
Klar, dass bei dem Befehl ein Fehler kommt. Der prefix-Parameter erwartet einen Pfad. Und der wird, was ich Dir zeigen wollte, bei einer Adapterinstallation auf c:\iobroker bei Dir gesetzt. Was auch in Ordnung ist.
Wen global aktiv ist, dann wird auch dort der .bin-Ordner abgelegt. Wenn nicht, dann im node_modules. Bei Dir ist default-global aus. Was auch richtig ist.
Mehr weiß ich leider nicht.
-
Schade - trotzdem Danke das du dir die Zeit genommen hast.