【问题标题】:ionic cordova local plugin error with new M1 macs新 M1 mac 的 ionic cordova 本地插件错误
【发布时间】:2021-04-26 11:19:49
【问题描述】:

我们有一些本地插件是使用 离子cordova插件添加./cordova-plugin-name

在 intel mac 上构建时它们工作正常,但在带有 Big Sur 的新 M1 mac 中构建项目时出现以下错误

Discovered saved plugin "cordova-plugin-ionic-keyboard". Adding it to the project
Installing "cordova-plugin-ionic-keyboard" for ios
Adding cordova-plugin-ionic-keyboard to package.json
Discovered saved plugin "cordova-plugin-iovation". Adding it to the project
Failed to restore plugin "cordova-plugin-iovation" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin file:scripts/plugin/cordova-plugin-iovation via registry. Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR!
Cannot read property 'match' of undefined
npm ERR!
npm ERR!
Discovered saved plugin "cordova-plugin-advanced-http". Adding it to the project
Failed to restore plugin "cordova-plugin-advanced-http" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin file:scripts/plugin/cordova-plugin-advanced-http via re gistry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR!
Cannot read property 'match' of undefined
A complete log of this run can be found in: /Users/xx/.npm/_logs/2021-01-21T12_29_50_477Z-debug.log
npm ERR!
npm ERR!
Discovered saved plugin "call-number". Adding it to the project
Installing "mx.ferreyra.callnumber" for ios
Adding mx.ferreyra.callnumber to package.json
Discovered saved plugin "cordova-plugin-app-version". Adding it
Installing "cordova-plugin-app-version" for ios

这是一个已知问题,我该如何解决?

【问题讨论】:

    标签: cordova ionic-framework ionic3 ionic4 cordova-plugins


    【解决方案1】:

    CLI 似乎不明白这些是本地插件,因此它会尝试从注册表中下载它们。这很可能是一个 npm 问题。科尔多瓦和 npm 7 不太好用。我建议你运行 node v15.6.0(最新的非 lts)。

    此版本通常与较新的 npm (v7) 捆绑在一起,但是要使其正常工作(直到 cordova 整理出他们的东西),您必须将 npm 降级到 6.14.11

    我已经这样做了(是否使用 sudo 将取决于您的环境设置):

    sudo npm i -g npm
    

    或者你可以指定一个版本:

    sudo npm i -g npm@version
    

    上述解决方案的来源: https://github.com/apache/cordova-cli/issues/541

    除此之外,我只需要战斗几个小时就可以在我的 M1 上构建东西......

    一些可能会对您有很大帮助的提示:

    • Cocoapods 需要安装在 Rosetta 模式终端中。在安装 cocoapods 并在 ios 平台文件夹中运行 pod install 之前,您很可能需要在同一终端中安装 ffi gem。默认情况下存在的原生 ffi gem 似乎不适用于 cocoapods。
    • 您必须在 XCode 中自动构建 arm64 和 x86_64 架构仿真器。如果不这样做,您将在构建时收到符号丢失错误。

    更新:看来 cordova 现在通过整理它们的依赖关系解决了这个问题。卸载并重新安装cordova应该会得到它需要的所有包来使用最新的稳定npm

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-17
      • 2019-09-03
      • 1970-01-01
      • 2014-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多