cordova 离子失败的建设在macos 12(蒙特雷)

pwuypxnk  于 2022-11-15  发布在  Mac
关注(0)|答案(7)|浏览(180)

当我在我新更新的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)
t98cgbkg

t98cgbkg1#

像这样编辑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']]
]);
kzipqqlq

kzipqqlq2#

要修复它,只需安装最新的macos-release,使用npm install macos-release@3.0.1 --save和MacOS 12(Monterey)将被定义。

zkure5ic

zkure5ic3#

这对我很有效:

npm uninstall -g cordova
npm install -g cordova@10.0.0
jxct1oxe

jxct1oxe4#

在挖掘“macos-release”库的源代码后,我发现“Monterey”版本不在此数组中,这就是问题的原因:

const nameMap = new Map([
    [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']]
]);

此“macos-release”库是“cordova”的一个依赖项:“^9.0.0”,所以对我有效的解决方案是从我的package.json文件中删除这个库,删除“node-modules”文件夹并再次安装所有依赖项。
另一个解决方案是升级到cordova 10.0.0。

tag5nh1u

tag5nh1u5#

当我将我的macOs更新为Ventura(13)时开始面临这个问题。因此,只是简单地在HashMap中添加了Os名称版本,而没有更新任何内容。

const nameMap = new Map([
    [21, ['Ventura', '13']],
    [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']]
]);
0dxa2lsx

0dxa2lsx6#

对于那些更新到Ventura的人,你也应该添加这个:

[22, ['Ventura', '13']],

所以它会是这样;

const nameMap = new Map([
    [22, ['Ventura', '13']],
    [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']]
]);

如果您不知道自己的版本,请尝试函数const macosRelease = release => {...中的console.log(release);

qzlgjiam

qzlgjiam7#

进入节点模块/macos-release/index. js
并将[21, ['Monterey', '12']],追加到nameMap中。

相关问题