Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
Current working directory is not a Cordova-based project.
-
I’m trying to add Cordova plugins to my project. Why, (when init-ing a project via vue-cli ) does my supposedly pre-configured Cordova app, not think it’s a Cordova app? Obviously it’s missing relevant files, but what is the “template” supposed to be if not Cordova-based? Also, what is the recommended mechanism for making it so besides “starting over”? :confounded:
-
@humblecoder Do you mean with Monaca? I think it’s looking for
www
folder, so simply runnpm run build
to generate it. I think I’ll need to add an emptywww
to the template to avoid this :sweat_smile:
-
@Fran-Diox well, the instruction says “vue-cordova-webpack” so my assumption was that we could use “pure” cordova. That said, running
npm run build
created thewww
folder, but I still can’t successfully run any other commands such asmonaca preview
without an error such asFailed serving project: Cannot read property 'build' of null
.Not to sound too obtuse, but it would be nice to have a “super obvious” A-Z presentation of how to create a project from scratch (without templates, etc.). Or, perhaps you do and I’ve simply missed it. :expressionless:
-
@humblecoder You should be able to use “pure” cordova, indeed. But then, you are trying to run Monaca commands here, right? There is a Monaca guide here for this specific template. This link (and more info) is shown in the terminal right after
vue init OnsenUI/vue-cordova-webpack
command finishes but I guess you didn’t see it.Vue CLI templates are a bit different from the rest of Monaca templates, so instead of
monaca preview
you’ll need to runnpm run dev
(it’s how Vue CLI templates work by default). I think all the necessary stuff is explained in that guide anyway :thumbsup:For creating projects without templates, well, you basically need to know how to create a Vue project. Onsen UI is just a plugin for it and you can see how to include it in the docs. After that, if you want your Vue app to be Cordova-like, have a look at their project structure guide. The most important things are
config.xml
andwww
folder (with all the public files). The rest is using Cordova CLI to add platforms and plugins, or Monaca CLI.
Therefore, what the templates provide is basically a Vue app with Onsen UI imported and a config.xml file. The build process has been also a bit changed to produce awww
folder instead of the defaultdist
folder.Edit: I just tried with Cordova CLI and the problem is the same, it simply needs
www
so you need to runnpm run build
.