{"action":"created","issue":{"url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/1590","repository_url":"https://api.github.com/repos/NativeScript/nativescript-cli","labels_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/1590/labels{/name}","comments_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/1590/comments","events_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/1590/events","html_url":"https://github.com/NativeScript/nativescript-cli/pull/1590","id":139729491,"number":1590,"title":"Fix plugin remove command for invalid plugins","user":{"login":"rosen-vladimirov","id":8351653,"avatar_url":"https://avatars.githubusercontent.com/u/8351653?v=3","gravatar_id":"","url":"https://api.github.com/users/rosen-vladimirov","html_url":"https://github.com/rosen-vladimirov","followers_url":"https://api.github.com/users/rosen-vladimirov/followers","following_url":"https://api.github.com/users/rosen-vladimirov/following{/other_user}","gists_url":"https://api.github.com/users/rosen-vladimirov/gists{/gist_id}","starred_url":"https://api.github.com/users/rosen-vladimirov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosen-vladimirov/subscriptions","organizations_url":"https://api.github.com/users/rosen-vladimirov/orgs","repos_url":"https://api.github.com/users/rosen-vladimirov/repos","events_url":"https://api.github.com/users/rosen-vladimirov/events{/privacy}","received_events_url":"https://api.github.com/users/rosen-vladimirov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NativeScript/nativescript-cli/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"rosen-vladimirov","id":8351653,"avatar_url":"https://avatars.githubusercontent.com/u/8351653?v=3","gravatar_id":"","url":"https://api.github.com/users/rosen-vladimirov","html_url":"https://github.com/rosen-vladimirov","followers_url":"https://api.github.com/users/rosen-vladimirov/followers","following_url":"https://api.github.com/users/rosen-vladimirov/following{/other_user}","gists_url":"https://api.github.com/users/rosen-vladimirov/gists{/gist_id}","starred_url":"https://api.github.com/users/rosen-vladimirov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosen-vladimirov/subscriptions","organizations_url":"https://api.github.com/users/rosen-vladimirov/orgs","repos_url":"https://api.github.com/users/rosen-vladimirov/repos","events_url":"https://api.github.com/users/rosen-vladimirov/events{/privacy}","received_events_url":"https://api.github.com/users/rosen-vladimirov/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/NativeScript/nativescript-cli/milestones/32","html_url":"https://github.com/NativeScript/nativescript-cli/milestones/1.7.0","labels_url":"https://api.github.com/repos/NativeScript/nativescript-cli/milestones/32/labels","id":1487326,"number":32,"title":"1.7.0","description":"","creator":{"login":"teobugslayer","id":5443453,"avatar_url":"https://avatars.githubusercontent.com/u/5443453?v=3","gravatar_id":"","url":"https://api.github.com/users/teobugslayer","html_url":"https://github.com/teobugslayer","followers_url":"https://api.github.com/users/teobugslayer/followers","following_url":"https://api.github.com/users/teobugslayer/following{/other_user}","gists_url":"https://api.github.com/users/teobugslayer/gists{/gist_id}","starred_url":"https://api.github.com/users/teobugslayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teobugslayer/subscriptions","organizations_url":"https://api.github.com/users/teobugslayer/orgs","repos_url":"https://api.github.com/users/teobugslayer/repos","events_url":"https://api.github.com/users/teobugslayer/events{/privacy}","received_events_url":"https://api.github.com/users/teobugslayer/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":10,"state":"open","created_at":"2016-01-06T13:07:27Z","updated_at":"2016-03-09T23:07:17Z","due_on":"2016-03-30T21:00:00Z","closed_at":null},"comments":2,"created_at":"2016-03-09T23:07:17Z","updated_at":"2016-03-10T09:33:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/1590","html_url":"https://github.com/NativeScript/nativescript-cli/pull/1590","diff_url":"https://github.com/NativeScript/nativescript-cli/pull/1590.diff","patch_url":"https://github.com/NativeScript/nativescript-cli/pull/1590.patch"},"body":"When invalid plugin data is written in project's package.json, `tns plugin remove <name>` command fails.\r\nIn such cases `npm uninstall --save <name>` just removes the entry from package.json, so we should do the same.\r\nBy invalid data I mean invalid version (not existing version or path to non-existing file).\r\n\r\nPlugin remove command's canExecute method is trying to install all plugins in order to get information about their native code, so it will be removed from `platforms` dir.\r\nThe installation fails when some plugin's data is invalid.\r\nCatch the error and check package.json's dependencies instead.\r\nAlso make sure plugin variables data is removed from package.json when plugin is removed.\r\nCurrently it's been removed only when platform is added and plugin has native code.\r\n\r\nFixes https://github.com/NativeScript/nativescript-cli/issues/1541"},"comment":{"url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/comments/194754484","html_url":"https://github.com/NativeScript/nativescript-cli/pull/1590#issuecomment-194754484","issue_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/1590","id":194754484,"user":{"login":"teobugslayer","id":5443453,"avatar_url":"https://avatars.githubusercontent.com/u/5443453?v=3","gravatar_id":"","url":"https://api.github.com/users/teobugslayer","html_url":"https://github.com/teobugslayer","followers_url":"https://api.github.com/users/teobugslayer/followers","following_url":"https://api.github.com/users/teobugslayer/following{/other_user}","gists_url":"https://api.github.com/users/teobugslayer/gists{/gist_id}","starred_url":"https://api.github.com/users/teobugslayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teobugslayer/subscriptions","organizations_url":"https://api.github.com/users/teobugslayer/orgs","repos_url":"https://api.github.com/users/teobugslayer/repos","events_url":"https://api.github.com/users/teobugslayer/events{/privacy}","received_events_url":"https://api.github.com/users/teobugslayer/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T09:33:45Z","updated_at":"2016-03-10T09:33:45Z","body":":+1: "}}