I have a Nuxt 2 app. I’ve followed the docs to add Capacitor and Android Support.
Everything is fine up to the point of running
npx cap add android. The android folder is generated however there are errors in the terminal
√ Adding native android project in android in 342.51ms √ Syncing Gradle in 944.40μp √ add in 345.44ms × copy android - failed! [error] The web assets directory (.\.nuxt) must contain an index.html file. It will be the entry point for the web portion of the Capacitor app. √ Updating Android plugins in 33.68ms × update android - failed! [error] Error: ENOENT: no such file or directory, open '<sourceroot>\android\app\src\main\assets\capacitor.plugins.json'
I’m not running Nuxt in static mode (due to routes and content pulled in dynamically from a CMS). So I run
nuxt build which generates the output into a folder named
.nuxt by default.
nuxt build doesn’t create an
index.html as an entry point, the nuxt build actually states
Entrypoint app = server.js server.js.map. Hence the error above where it can’t find
index.html in the
Does anyone know a way to resolve this?
I’ve found resources when using
nuxt generate for a static app but not
nuxt build for a spa like in my case.