9

我在 Cordova 中安装自定义插件时遇到问题。

plugman -d install --platform android --project platforms\android --plugin plugins\PrintName

错误:

Cannot read property 'fail' of undefined TypeError: Cannot read property 'fail' of undefined
at C:\...\AppData\Roaming\npm\node_modules\plugman\node_modules\cordova-lib\src\plugman\fetch.js:168:18
at _fulfilled (C:\...\AppData\Roaming\npm\node_modules\plugman\node_modules\q\q.js:787:54)
at self.promiseDispatch.done (C:\...\AppData\Roaming\npm\node_modules\plugman\node_modules\q\q.js:816:30)
at Promise.promise.promiseDispatch (C:\...\AppData\Roaming\npm\node_modules\plugman\node_modules\q\q.js:749:13)
at C:\...\AppData\Roaming\npm\node_modules\plugman\node_modules\q\q.js:509:49
at flush (C:\...\AppData\Roaming\npm\node_modules\plugman\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:686:11)
at startup (bootstrap_node.js:187:16)
4

3 回答 3

15

您需要指定完整的插件路径,而不是相对路径。例如:

plugman -d install --platform android --project platforms\android --plugin "\full_path\of_your\plugins\PrintName"
于 2018-02-08T03:44:04.273 回答
11

我最终要做的是卸载plugman 2.0

npm remove -g plugman

然后我安装plugman 1.5.1版

npm install -g plugman@1.5

然后我终于可以在项目中添加插件了。

于 2018-01-26T19:31:25.307 回答
0

只需添加自定义 Cordova 插件的完整路径

于 2018-09-07T11:52:09.870 回答