NavCore / ngCordova

Angular 4 + Cordova Boilerplate
29 stars 18 forks source link

CordovaError when run cordova platform ls #4

Open lilonpro opened 6 years ago

lilonpro commented 6 years ago

When run the command "cordova platform ls" I got "CordovaError: Current working directory is not a Cordova-based project." and I have checked I am in the ngCordova diretory.

NavCore commented 6 years ago

Hi!

Did you solve your problem with cordova platform listing? I just navigate to ngCordova directory and run 'cordova platform ls' command and it didn't show me that error, than this:

Installed platforms:

Available platforms: android ~6.3.0 blackberry10 ~3.8.0 (deprecated) browser ~5.0.0 ios ~4.5.1 osx ~4.0.1 ubuntu ~4.3.4 (deprecated) webos ~3.7.0 windows ~5.0.0 www ^3.12.0

Because this is a boilerplate, I didn't installed any platform, so that anyone starting to use this boilerplate can install platform at his wish.

Also, when you navigate to ngCordova directory, please run 'ls' command to print all files in it. You should see this list of files:

e2e hooks node_modules platforms plugins res src www .angular-cli.json .editorconfig .gitignore .npmignore config.xml karma.conf.js package.json protractor.conf.js README.md tsconfig.json tslint.json

Good luck!

ghost commented 6 years ago

Hi mingzwork, I think you have to "ng build" before trying to run on a device so that node can create the "www" folder and Cordova recognizes the project folder as a Cordova project

salvadorOrtega commented 6 years ago

It should also be noted that by the Angular team's design, every time you run the "ng serve" command the Angular CLI will delete the folder specified as 'outDir' in the angular-cli.json file, meaning that since ngCordova sets 'outDir' to be the www folder, running "ng serve" will delete it and make contiguous attempts to run cordova commands issue this same CordovaError.