cordova8 で plugin addエラー 最低限のpackage.jsonが必要

cordova7まではpluginのpackage.jsonなしでもプラグインの追加を行えた。cordova8からはpackage.jsonの中も見てるようで最低限のpackage.jsonが必要になったぽい。

package.json

{
  "name": "my_plugin",
  "version": "0.0.1",
  "description": ""
}

試したらnameとversionとdescriptionだけあればokだった。メンテされてないプラグインはどうすればいいのだろう。いちおうエラー内容もメモしておく

package.jsonなしの場合

$ ionic cordova plugin add /path/to/cordova-plugin-my-plugin/
> cordova plugin add /path/to/cordova-plugin-my-plugin/ --save
(node:20136) UnhandledPromiseRejectionWarning: CordovaError: Invalid Plugin! /path/to/cordova-plugin-my-plugin needs a valid package.json
    at /Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:92:41
    at _fulfilled (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:749:13)
    at /Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:509:49
    at flush (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:108:17)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:191:16)
(node:20136) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejec\
tion id: 1)
(node:20136) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

package.jsonに不備の場合

$ ionic cordova plugin add /path/to/cordova-plugin-my-plugin/
> cordova plugin add /path/to/cordova-plugin-my-plugin/ --save
(node:20157) UnhandledPromiseRejectionWarning: CordovaError: Error: npm: Command failed with exit code 1 Error output:
npm ERR! code EINVALIDTYPE
npm ERR! typeerror Error: Argument #2: Expected string but got null
npm ERR! typeerror     at exports.findRequirement (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/npm/lib/install/deps.js:721:3)
npm ERR! typeerror     at findChild (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/npm/lib/install/deps.js:109:17)
npm ERR! typeerror     at computeMetadata (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/npm/lib/install/deps.js:119:9)
npm ERR! typeerror     at Installer.normalizeCurrentTree (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/npm/lib/install.js:408:3)
npm ERR! typeerror     at Array.<anonymous> (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
npm ERR! typeerror     at LOOP (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
npm ERR! typeerror     at /Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/chain.js:18:7
npm ERR! typeerror     at iferr (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/npm/lib/install.js:362:5)
npm ERR! typeerror     at a (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/npm/node_modules/iferr/iferr.js:3:64)
npm ERR! typeerror     at cb (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/async-map.js:47:24)
npm ERR! typeerror     at /Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/npm/node_modules/call-limit/call-limit.js:22:12
npm ERR! typeerror     at _combinedTickCallback (internal/process/next_tick.js:131:7)
npm ERR! typeerror     at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/hogehoge/.npm/_logs/2018-08-16T06_30_08_468Z-debug.log
    at /Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:112:45
    at _rejected (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:864:24)
    at /Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:890:30
    at Promise.when (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:808:41)
    at /Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:624:44
    at runSingle (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:137:13)
    at flush (/Users/hogehoge/.nodebrew/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
(node:20157) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejec\
tion id: 1)
(node:20157) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

以上です