i have developed some times ago an app with ionic v.1 , now on my mac i have installed ioniv v.2, if i enter in directory project ionic v.1 and launch command " ionic serve " i receive this error message:
[ERROR] Sorry! ionic serve can only be run in an Ionic project directory.
i have tried with a tricks:
Create a new ionic app launching command
ionic start newapp blank --v1
i have copied all contents from /www ionic v.1 app directory in /www new app directory
I have copied directory /plugins from ionic v.1 app to new app directory
I have launched "cordova prepare " and " cordova platform add android "
If i launch command “ionic serve” i see a blank project and not my app
No, what you installed was most certainly the Ionic CLI in a version. Please give us the output of ionic info so we know which one exactly you installed.
Can you now please post the exact output you get when you run ionic --help and ionic serve in the ionic-v1 project directory you have?
If this doesn’t work (please post the output here anyway!) please run this command to install some stuff the v3 CLI needs for working with Ionic v1 projects: npm install --save-dev --save-exact @ionic/cli-plugin-ionic1@latest @ionic/cli-plugin-cordova@latest
Then try again to run ionic serve.
ionic --help
_ _
(_) (_)
_ ___ _ __ _ ___
| |/ _ \| '_ \| |/ __|
| | (_) | | | | | (__
|_|\___/|_| |_|_|\___| CLI 3.0.0
Usage:
$ ionic <command> [arguments] [options]
$ ionic <command> --help (for command details)
Global Commands:
docs ................ Open the Ionic documentation website
info ................ Print system/environment info
login ............... Login with your Ionic ID
signup .............. Create an Ionic account
start ............... Create a new project
telemetry ........... Opt in and out of telemetry
Project Commands:
You are not in a project directory.
Options:
--verbose ........... Verbose output for debugging
--help .............. Show help for provided command
after run “ionic serve” in the ionic v.1 project
ionic serve
[ERROR] Sorry! ionic serve can only be run in an Ionic project directory.
Oh, now I notice you already have the ionic-angular plugin in your project - and also Ionic Framework 3.1.1. Where did you run ionic info before? This indicates it was in a newly created project directory with the current Ionic version. Correct?
Can you run ionic info in the folder of you Ionic v1 project please?
(Same for the npm install command I posted before by the way)
Before i have run “ionic info” in other directory, i have seen it now, sorry for the mistake
Run ionic info in my ionic v.1 directory project i receive
ionic info
[WARN] You are not in an Ionic project directory. Project context may be missing.
global packages:
@ionic/cli-utils : 1.0.0
Ionic CLI : 3.0.0
System:
Node : v6.10.3
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002
ios-deploy : not installed
ios-sim : not installed
i don’t understand beacuse system gives me this warnig
[WARN] You are not in an Ionic project directory. Project context may be missing.
i’m in ionic project directory!!
Even before i have launched this command in ionic v.1 project directory and it is the answer
> @ionic/cli-plugin-cordova@1.0.0 postinstall /Users/Project/car-app/node_modules/@ionic/cli-plugin-cordova
> node ./bin/postinstall
/Users/Project/car-app
├── @ionic/cli-plugin-cordova@1.0.0
└── @ionic/cli-plugin-ionic1@1.0.0
npm WARN Invalid name: "Car APP"
npm WARN radio No description
npm WARN radio No repository field.
npm WARN radio No README data
npm WARN radio No license field.
again launching command “ionic serve” in this directory i receive
[ERROR] Sorry! ionic serve can only be run in an Ionic project directory.
ionic info
[WARN] You are not in an Ionic project directory. Project context may be missing.
global packages:
@ionic/cli-utils : 1.0.0
Ionic CLI : 3.0.0
System:
Node : v6.10.3
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002
ios-deploy : not installed
ios-sim : not installed
What does package.json and config.xml look like in this folder?
What is the file structure in this folder? (tree should help to give an copyable overview)
We need the content of package.json and config.xml - you can leave out your project details.
The tree is also only part of the complete output - run something like tree > file.txt to get it all into a file you can upload at pastebin.
That is strange. Running npm install --save-dev --save-exact @ionic/cli-plugin-ionic1@latest @ionic/cli-plugin-cordova@latest should have added these here.
Have a look at the package.json from your newly created Ionic 3 project. Recreate what you find concerning these plugins in your package.json of the v1 project (and then change it from cli-plugin-ionic-angular to cli-plugin-ionic1!!) and then run npm install in the project directory of the v1 project.
Then ionic serve and ionic info again and give us the output.
I have followed @GabberMan suggest and it has worked.
below new ionic info
ionic info
global packages:
@ionic/cli-utils : 1.0.0
Cordova CLI : 7.0.0
Ionic CLI : 3.0.0
local packages:
@ionic/cli-plugin-cordova : 1.0.0
@ionic/cli-plugin-ionic1 : 1.0.0
Ionic Framework : ionic1 1.2.4
System:
Node : v6.10.3
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002
ios-deploy : not installed
ios-sim : not installed
thank you for all @Sujan12, i don’t understand what it’s broken and because i need to modify ionic.project file in ionic.config.json, but it’s worked for me.