[ionic]解决运行Android、IOS出现Could not find the web assets directory

简介: [ionic]解决运行Android、IOS出现Could not find the web assets directory

出现场景

使用Capacitor运行App时,出现以下提示。

adodeMacBook-Pro:ionic_app ado$ npx cap run android
✖ copy android - failed!
[error] Could not find the web assets directory: ./build.
        Please create it and make sure it has an index.html file. You can change
        the path of this directory in capacitor.config.ts (webDir option). You
        may need to compile the web assets for your app (typically npm run
        build). More info:
        https://capacitorjs.com/docs/basics/workflow#sync-your-project
✔ Updating Android plugins in 26.08ms
✖ update android - failed!
[error] Error: ENOENT: no such file or directory, open
        '/Users/ado/my/work/h5/ionic_app/android/app/src/main/assets/capacitor.plugins.json'

解决方案

这是因为还没有为app编译生成web资源文件,我们先使用ionic build编译一次

adodeMacBook-Pro:ionic_app ado$ ionic build
> react-scripts build
Creating an optimized production build...
Compiled successfully.

我们可以看到项目根目录出现了一个build文件夹,说明已经编译成功。

再次运行npx cap run android或者npx cap run ios即可成功运行。

相关文章
|
10天前
|
缓存 Java 测试技术
【01】噩梦终结flutter配安卓android鸿蒙harmonyOS 以及next调试环境配鸿蒙和ios真机调试环境-flutter项目安卓环境配置-gradle-agp-ndkVersion模拟器运行真机测试环境-本地环境搭建-如何快速搭建android本地运行环境-优雅草卓伊凡-很多人在这步就被难倒了
【01】噩梦终结flutter配安卓android鸿蒙harmonyOS 以及next调试环境配鸿蒙和ios真机调试环境-flutter项目安卓环境配置-gradle-agp-ndkVersion模拟器运行真机测试环境-本地环境搭建-如何快速搭建android本地运行环境-优雅草卓伊凡-很多人在这步就被难倒了
122 3
【01】噩梦终结flutter配安卓android鸿蒙harmonyOS 以及next调试环境配鸿蒙和ios真机调试环境-flutter项目安卓环境配置-gradle-agp-ndkVersion模拟器运行真机测试环境-本地环境搭建-如何快速搭建android本地运行环境-优雅草卓伊凡-很多人在这步就被难倒了
|
6月前
|
iOS开发 MacOS Perl
解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘
解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘
262 4
|
6月前
|
开发工具 iOS开发
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
253 2
|
6月前
|
iOS开发
解决Flutter运行IOS报错:Podfile is out of date
解决Flutter运行IOS报错:Podfile is out of date
102 1
|
6月前
|
开发工具 Android开发
解决Android Studio编译提示NDK is missing a “platforms“ directory
解决Android Studio编译提示NDK is missing a “platforms“ directory
296 1
|
6月前
|
Web App开发 移动开发 前端开发
如何优化运行在webkit上的web app
如何优化运行在webkit上的web app
|
6月前
|
iOS开发 Android开发 MacOS
从零到全能开发者:解锁Uno Platform,一键跨越多平台应用开发的神奇之旅,让你的代码飞遍Windows、iOS、Android、macOS及Web,技术小白也能秒变跨平台大神!
【8月更文挑战第31天】从零开始,踏上使用Uno Platform开发跨平台应用的旅程。只需编写一次代码,即可轻松部署到Windows、iOS、macOS、Android及Web(通过WASM)等多个平台。Uno Platform为.NET生态带来前所未有的灵活性和效率,简化跨平台开发。首先确保安装了Visual Studio或VS Code及.NET SDK,然后选择合适的项目模板创建新项目。项目结构类似传统.NET MAUI或WPF项目,包含核心NuGet包。通过简单的按钮示例,你可以快速上手并构建应用。Uno Platform让你的技术探索之旅充满无限可能。
173 0
|
6月前
|
Shell PHP Windows
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
|
7月前
|
移动开发 小程序 JavaScript
跨端技术问题之转Web运行时的“框架”模块主要负责什么功能
跨端技术问题之转Web运行时的“框架”模块主要负责什么功能
|
8月前
|
关系型数据库 MySQL API
实时计算 Flink版操作报错合集之同步MySQL数据到另一个MySQL数据库,第一次同步后源表数据发生变化时目标表没有相应更新,且Web UI中看不到运行的任务,该怎么解决
在使用实时计算Flink版过程中,可能会遇到各种错误,了解这些错误的原因及解决方法对于高效排错至关重要。针对具体问题,查看Flink的日志是关键,它们通常会提供更详细的错误信息和堆栈跟踪,有助于定位问题。此外,Flink社区文档和官方论坛也是寻求帮助的好去处。以下是一些常见的操作报错及其可能的原因与解决策略。
224 0

热门文章

最新文章