NativeScript / NativeScript/nativescript-cli
`tns plugin add` fails when tns-android key is missing in package.json of the app
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 1.1k
- Forks
- 204
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 8
Beschreibung
Did you verify this is a real problem by searching
Yes, here.
Tell us about the problem
I do a lot of plugin development ;-) I tend to do
tns plugin add ../src or tns plugin add pluginname-1.0.0.tgz
All of these will cause nativescript to throw a error
TypeError: Cannot read property 'version' of undefined
at PluginsService.getInstalledFrameworkVersion (/usr/local/lib/node_modules/nativescript/lib/services/plugins-service.js:261:29)
at PluginsService.isPluginDataValidForPlatform (/usr/local/lib/node_modules/nativescript/lib/services/plugins-service.js:265:48)
at PluginsService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/services/plugins-service.js:57:26)
at next (native)
at /usr/local/lib/node_modules/nativescript/lib/services/plugins-service.js:7:71
at __awaiter (/usr/local/lib/node_modules/nativescript/lib/services/plugins-service.js:3:12)
at action (/usr/local/lib/node_modules/nativescript/lib/services/plugins-service.js:56:83)
at PluginsService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/services/plugins-service.js:253:27)
at next (native)
at /usr/local/lib/node_modules/nativescript/lib/services/plugins-service.js:7:71
The issue is inserted in the package.json: "nativescript-pluginname": "file:<path to dir>",
When you attempt to get version numbers, "file:....." doesn't match and causes the above error.
Which platform(s) does your issue occur on?
Both
Please provide the following version numbers that your issue occurs with:
At least since TNS 3.0, still happening in 3.2
Please tell us how to recreate the issue in as much detail as possible.
tns plugin add ../src from a demo folder
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in lib/services/plugins-service.js, insbesondere bei PluginsService.getInstalledFrameworkVersion und isPluginDataValidForPlatform, und reproduziere das anschließend mit tns plugin add ../src aus einer Demo-App. Verfolge, wie die file:-Abhängigkeit behandelt wird, wenn der package.json der App kein tns-android-Schlüssel enthält. Als abgeschlossen gilt die Aufgabe, wenn das Hinzufügen von Plugins aus lokalen Verzeichnissen und Tarballs auf keiner der beiden Plattformen mehr den undefined-version-Fehler auslöst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- cli
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100