我一直在尝试在我的 iPhone 上安装并测试一个应用程序,但它不起作用。在我将 @nuxtjs/ionic 安装到我的项目并尝试通过 Xcode 在我的设备上运行该应用程序后,我收到这些错误
⚡️ WebView loaded
⚡️ [error] - [nuxt] error caught during app initialization {}
在控制台中和
Run script build phase '[CP] Embed Pods Frameworks' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase.
在侧边栏中,应用程序永远是白屏。仅当我安装了 @nuxtjs/ionic 时才会发生这种情况。那么模块有问题吗?
它也可以在模拟器或实时服务器上成功运行,但不能在物理设备中运行
尝试更改节点版本
添加后我遇到了类似的问题
~/pages
在解构赋值期间尝试获取 ~/node_modules/nuxt/dist/app/nuxt.js
时,
{ provide }
中的第 110 行出现错误。这是通过添加
try/catch
的临时解决方法:
export async function applyPlugin(nuxtApp, plugin) {
if (plugin.hooks) {
nuxtApp.hooks.addHooks(plugin.hooks);
}
if (typeof plugin === "function") {
try { // fix :: ⚡️ [error] - [nuxt] error caught during app initialization {} :: savva
const { provide } = await nuxtApp.runWithContext(() => plugin(nuxtApp)) || {};
if (provide && typeof provide === "object") {
for (const key in provide) {
nuxtApp.provide(key, provide[key]);
}
}
} catch (e) {
// end fix :: ⚡️
}
}
}
我的配置:
"devDependencies": {
"@capacitor/cli": "5.5.1",
"@nuxt/devtools": "latest",
"@nuxtjs/ionic": "^0.12.1",
"nuxt": "^3.8.0",
"typescript": "^5.2.2",
"vue": "^3.3.7",
"vue-router": "^4.2.5"
},
期待更永久的解决方案!