NativeScript / NativeScript/nativescript-cli
`tns plugin add` fails when tns-android key is missing in package.json of the app
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 1.1k
- Fork
- 204
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 8
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu trong lib/services/plugins-service.js, đặc biệt là PluginsService.getInstalledFrameworkVersion và isPluginDataValidForPlatform, sau đó tái hiện bằng tns plugin add ../src từ một ứng dụng demo. Theo dõi cách dependency file: được xử lý khi package.json của ứng dụng không có khóa tns-android. Được xem là hoàn tất khi việc thêm plugin từ các thư mục cục bộ và tarball không còn gây ra lỗi undefined-version trên cả hai nền tảng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- cli
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100