我有一个离子应用程序,我正在尝试为iOS和android构建它。通过离子发球效果很好。没有错误。
$ cordova build ios --buildFlag='-UseModernBuildSystem=0'
Cannot read property 'reject' of undefined
没有其他消息。
使用--verbose给出
$ cordova build ios --buildFlag='-UseModernBuildSystem=0' --verbose
No scripts found for hook "before_build".
Executing script found in plugin cordova-custom-config for hook "before_prepare": plugins/cordova-custom-config/hooks/restoreBackups.js
Cannot read property 'reject' of undefined
TypeError: Cannot read property 'reject' of undefined
at module.exports (/Users/mj/rethink/3/rethink/plugins/cordova-custom-config/hooks/restoreBackups.js:134:18)
at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
at process._tickCallback (internal/process/next_tick.js:43:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:777:11)
at executeUserCode (internal/bootstrap/node.js:342:17)
at startExecution (internal/bootstrap/node.js:276:5)
at startup (internal/bootstrap/node.js:227:5)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
答案 0 :(得分:2)
做
$ cordova plugin ls
列出您的插件。
您将看到:
cordova-custom-config 5.0.2 "cordova-custom-config"
这是导致构建失败的原因。
修复,删除和添加版本5.1.0
但是,在删除插件时,我们会遇到相同的错误:
$ cordova plugin rm cordova-custom-config
Cannot read property 'reject' of undefined
要解决此问题,请手动删除插件:
$ rm -rf plugins/cordova-custom-config/
Apples-iMac:rethink mj$ cordova plugin rm cordova-custom-config
Plugin "cordova-custom-config" is not present in the project. See `cordova plugin list`.
添加正确版本的插件:
$ cordova plugin add cordova-custom-config@5.1.0
Plugin "cordova-custom-config" already installed on android.
Adding cordova-custom-config to package.json
然后重新构建:
$ cordova build ios --buildFlag='-UseModernBuildSystem=0' --verbose
..
..
..
** BUILD SUCCEEDED **
No scripts found for hook "after_compile".
No scripts found for hook "after_build".
希望这会有所帮助。