开发者问题收集

Ionic 在 macOS 12 (Monterey) 中构建失败

2021-07-09
16245

当我在新更新的 macos 12(Monterey)上运行“ionic cordova build ios”时,我收到此错误:

Uncaught Exception:
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
at macosRelease (/Applications/XXX.app/Contents/Resources/app.asar/node_modules/macos-release/index.js:26:26)
at Object.<anonymous> (/Applications/XXX.app/Contents/Resources/app.asar/main/utils/errors.js:54:17)
at Module._compile (internal/modules/cjs/loader.js:968:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:986:10)
at Module.load (internal/modules/cjs/loader.js:816:32)
at Module._load (internal/modules/cjs/loader.js:728:14)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:853:19)
at require (internal/modules/cjs/helpers.js:74:18)
3个回答

像这样编辑 nameMap

const nameMap = new Map([
    [21, ['Monterey', '12']],
    [20, ['Big Sur', '11']],
    [19, ['Catalina', '10.15']],
    [18, ['Mojave', '10.14']],
    [17, ['High Sierra', '10.13']],
    [16, ['Sierra', '10.12']],
    [15, ['El Capitan', '10.11']],
    [14, ['Yosemite', '10.10']],
    [13, ['Mavericks', '10.9']],
    [12, ['Mountain Lion', '10.8']],
    [11, ['Lion', '10.7']],
    [10, ['Snow Leopard', '10.6']],
    [9, ['Leopard', '10.5']],
    [8, ['Tiger', '10.4']],
    [7, ['Panther', '10.3']],
    [6, ['Jaguar', '10.2']],
    [5, ['Puma', '10.1']]
]);
LordMOS
2021-09-24

这对我有用:

npm uninstall -g cordova
npm install -g [email protected]
Teran Peterson
2021-10-28

要修复此问题,只需安装最新的 macos-release ,使用 npm install [email protected] --save ,即可定义 MacOS 12 (Monterey)。

frankyt79
2021-11-03