新 M1 mac 的 ionic cordova 本地插件错误
ionic cordova local plugin error with new M1 macs
我们有一些本地插件是使用
ionic cordova 插件添加 ./cordova-plugin-name
在英特尔 macs 上构建时它们工作正常,但在带有 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
这是一个已知问题吗?我该如何解决?
CLI 似乎无法识别这些是本地插件,因此它尝试从注册表中下载它们。这很可能是 npm 问题。在 cordova 和 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 和 运行ning pod install 到 ios 平台文件夹之前,您很可能需要在同一个终端中安装 ffi gem。默认情况下的原生 ffi gem 似乎不适用于 cocoapods。
- 您必须排除 arm64 和 x86_64 架构模拟器,使其无法在 XCode 中自动构建。如果不这样做,构建时会出现符号丢失错误。
更新:看起来 cordova 现在已经通过整理它们的依赖关系解决了这个问题。卸载并重新安装 cordova 应该会得到所有需要的包,以便它与最新的稳定 npm
一起工作
我们有一些本地插件是使用 ionic cordova 插件添加 ./cordova-plugin-name
在英特尔 macs 上构建时它们工作正常,但在带有 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
这是一个已知问题吗?我该如何解决?
CLI 似乎无法识别这些是本地插件,因此它尝试从注册表中下载它们。这很可能是 npm 问题。在 cordova 和 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 和 运行ning pod install 到 ios 平台文件夹之前,您很可能需要在同一个终端中安装 ffi gem。默认情况下的原生 ffi gem 似乎不适用于 cocoapods。
- 您必须排除 arm64 和 x86_64 架构模拟器,使其无法在 XCode 中自动构建。如果不这样做,构建时会出现符号丢失错误。
更新:看起来 cordova 现在已经通过整理它们的依赖关系解决了这个问题。卸载并重新安装 cordova 应该会得到所有需要的包,以便它与最新的稳定 npm
一起工作