Reputation: 191
I am using ionic 1 project. After update cordova i get "[ERROR] Sorry! ionic serve can only be run in an Ionic project directory" error message in ionic 1 project. When i try to create new ionic project by "ionic start myApp tabs" It build me new project and its ionic 2. How can i go back to ionic 1 and run my old project ?
Upvotes: 7
Views: 48149
Reputation: 91
It's because your project is not an Ionic project. Running the following will solve the problem:
ionic init
Upvotes: 6
Reputation: 79
I had a similar issue where an older Ionic V1 application was originally written using a Visual Studio 2015 project. I wanted to use the Ionic CLI to build the application instead. This is what I did as of Ionic CLI version 4.0.6 to get past the "can only be run in an Ionic project directory" error.
{
"name": "AppName",
"integrations": {
"gulp": {},
"cordova": {},
},
"type": "ionic1",
"watchPatterns": [
"scss/**/*",
"www/**/*",
"!www.lib/**/*",
"!www/**/*.map"
]
}
npm install ionic -g
"ionic cordova build ios
" or "ionic cordova build android
" depending on what you want.Upvotes: 7
Reputation: 161
Whenever there's this particular error, do make sure that you are in an Ionic Project directory. If you're not, go to the directory and run the command, it'll work. Hope it helps.
Upvotes: 0
Reputation: 2057
If you get ERROR Sorry! ionic serve can only be run in an Ionic project directory, make sure you create an empty "www" directory at the project root. If cordova does not find a "www" directory, it will cry out that error.
To create a project with the latest ionic cli, you will need to add the flag --type ionic1
at the end to make sure that you grab Ionic 1 and not the latest ionic version.
example:
ionic start myApp tabs --type ionic1
This will generate a new project with ionic v1. Reference: https://github.com/driftyco/ionic-cli/blob/master/README.md#ionic-1
Upvotes: 4
Reputation: 26
I used the command below and it worked. ionic state reset --plugins
Upvotes: 0
Reputation: 100
i have also the some problem when i have updated ionic/cordova and have created my first app with ionic 3, after that i can't run my older ionic 1 app. Below the steps which i have done for run my ionic 1 app
1.Go to the newly created project (with Ionic 3.*) and open package.json
2.There should be line like "@ionic/cli-plugin-ionic-angular"
3.Copy this line to package.json of your Ionic v1 project(on V2 app can be other plugins starting with cli-plugin-.. as well, you can move these too)
4.Change the ionic-angular to ionic1 like this "@ionic/cli-plugin-ionic1"
5.Run npm install in your v1 project folder
6.Rename the file ionic.project to ionic.config.json
7.Then try ionic serve
hope your v1 app will be started
Upvotes: 4