TypeError:无法读取未定义离子的属性“名称”

时间:2019-10-31 07:41:04

标签: ios angular cordova ionic-framework

我正在用Ionic做一个项目。

当我尝试ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"时发生了错误

  

TypeError:无法读取未定义的属性“名称”

要了解更深层次的原因--verbose使用时

 at /Users/myname/ionic/platforms/ios/cordova/lib/build.js:130:60

我能够确定这是错误的来源,但我不知道该错误的解决方案。

var promise = require('./list-emulator-build-targets').targetForSimIdentifier(newTarget);
return promise.then(function (theTarget) {
    if (!theTarget) {
        return getDefaultSimulatorTarget().then(function (defaultTarget) {
            emulatorTarget = defaultTarget.name;
            events.emit('log', 'Building for ' + emulatorTarget + ' Simulator');
            return emulatorTarget;
        });
    } else {
        emulatorTarget = theTarget.name;
        events.emit('log', 'Building for ' + emulatorTarget + ' Simulator');
        return emulatorTarget;
    }
});

1 个答案:

答案 0 :(得分:0)

此错误过程MacOS Catalina

https://github.com/apache/cordova-ios/issues/427#issuecomment-503522317

修复代码platform/ios/cordova/liblist-emulator-build-targets

var availableDevices = Object.keys(devices).reduce(function (availAcc, deviceCategory) {
    var availableDevicesInCategory = devices[deviceCategory];
    availableDevicesInCategory.forEach(function (device) {
        if (device && device.name === deviceType.name.replace(/\-inch/g, ' inch') && device.isAvailable == true) {
           availAcc.push(device);
        }
     });
     return availAcc;
}, []);