Reputation: 2872
I want to use the PhoneGap Developer App for my project. I updated my PhoneGap version on my Mac to the newest version with the following command:
sudo npm install -g phonegap
Then I cd
ed to my project folder (root folder) and entered the command phonegap serve
, but everything I get is an [error] project directory could not be found
. When I create a completely new project, than everything works fine, but why can't I use that Developer App with my current project?
Upvotes: 4
Views: 11202
Reputation: 2045
Installing the sample project with version 5.0.0-0.27.1 did not create the .cordova
directory, so I didn't add one to my project.
Renaming the project asset directory to www
fixed the issue for me.
Upvotes: 1
Reputation: 11990
I've already come back with this question twice so I'll add my own answer that's slightly faster for me than creating another solution and copying the .cordova
directory.
From your project root:
mkdir .cordova
Create a file called config.json
with the following contents
{
"lib": {
"www": {
"id": "com.phonegap.helloworld",
"version": "3.5.0",
"uri": "https://github.com/phonegap/phonegap-app-hello-world/archive/3.5.0.tar.gz"
}
}
}
**You don't even have to modify the contents of the file.
$ phonegap serve
now works.
For the 'right' answer though that's more likely to work with future versions of cordova/phonegap, follow the answer of BZMWillemsen.
Upvotes: 2
Reputation: 59
I had the same but the project that it couldn't find was the default "hello world", it re-downloaded it when I created a new project as per Dawson's answer. After that my original project worked fine.
Upvotes: -1
Reputation: 5983
The phonegap
commands create a hidden directory at the root of the app called /.cordova
You can move this directory into your existing app created with cordova
to enable phonegap serve
mv /app-created-with-phone-gap/.cordova /app-create-with-cordova/
Upvotes: 6
Reputation: 6029
If the project was created with cordova
it will be easiest to create a new project with phonegap
and then copy over the www
and config.xml
from the existing project. You will also have to add the plugins to this new project but still use cordova plugin add
to do so.
Upvotes: 4