TypeError:无法读取未定义的属性“变量”

时间:2018-10-12 14:15:10

标签: android typescript cordova

我目前正在从事离子项目。但是,当我尝试为Android生成发行版时,会出现以下错误:

 Android Studio project detected
(node:13116) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'variables' of undefined
    at C:\Users\Digitalis 2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\restore-util.js:322:57
    at Array.forEach (<anonymous>)
    at Object.installPluginsFromConfigXML (C:\Users\Digitalis 2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\restore-util.js:318:28)
    at C:\Users\Digitalis 2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:59:32
    at _fulfilled (C:\Users\Digitalis 2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\Digitalis 2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:816:30)
    at Promise.promise.promiseDispatch (C:\Users\Digitalis 2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:749:13)
    at C:\Users\Digitalis 2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:557:44
    at flush (C:\Users\Digitalis 2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:108:17)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
(node:13116) 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(). (rejection id: 1)
(node:13116) [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.

我在右边的文件夹中执行了命令:ionic cordova build --release android,我的所有软件包都是最新的。

如果有人知道我为什么会收到此错误(我不理解)以及如何解决它,我将非常感激!

1 个答案:

答案 0 :(得分:0)

我找到了答案,cordova-barcode-scanner插件有问题 。版本太旧,我不得不切换到phonegap-plugin-barcodescanner,一切正常!