Aakash Thakur
Aakash Thakur

Reputation: 3905

Couldn't find ionic.config.json file. Are you in an Ionic project?

I am new to Ionic and trying to run ionic serve to test my application but I keep getting this error:

Couldn't find ionic.config.json file. Are you in an Ionic project?

On running ionic info, I get the following:

 $ ionic info
******************************************************
 Dependency warning - for the CLI to run correctly,
 it is highly recommended to install/upgrade the following:

 Please update your Cordova CLI to version  >=4.2.0 `npm install -g cordova`

******************************************************

Your system information:

Cordova CLI: undefined
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.1.7
OS: Windows 7
Node Version: v4.4.5

Tried it with Couldn't find ionic.config.json file but couldn't resolve the issue.

I am also getting this trace while creating an application with ionic start myApp tabs:

Installing npm packages (may take a minute or two)...
Error with start Error: spawn UNKNOWN
    at exports._errnoException (util.js:870:11)
    at ChildProcess.spawn (internal/child_process.js:298:11)
    at Object.exports.spawn (child_process.js:362:9)
    at spawn (C:\Users\user\AppData\Roaming\npm\node_modules\ionic\node_modules\                                                            ionic-app-lib\node_modules\cross-spawn\index.js:17:18)
    at Object.runSpawnCommand (C:\Users\user\AppData\Roaming\npm\node_modules\io                                                            nic\node_modules\ionic-app-lib\lib\start.js:56:17)
    at C:\Users\user\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-a                                                            pp-lib\lib\start.js:104:20
    at _fulfilled (C:\Users\user\AppData\Roaming\npm\node_modules\ionic\node_mod                                                            ules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\user\AppData\Roaming\npm\node_modules                                                            \ionic\node_modules\q\q.js:816:30)
    at Promise.promise.promiseDispatch (C:\Users\user\AppData\Roaming\npm\node_m                                                            odules\ionic\node_modules\q\q.js:749:13)
    at C:\Users\user\AppData\Roaming\npm\node_modules\ionic\node_modules\q\q.js:                                                            557:44

Can someone please help here.

Upvotes: 5

Views: 21461

Answers (10)

Hamit
Hamit

Reputation: 916

Create an ionic.config.json file manually in your project folder. Copy below mentioned code in this file:

{
  "name": "Replace with your project name",
  "app_id": "",
  "v2": true,
  "typescript": true
}

perform an npm install to ensure all node_modules are updated. This worked for me

Upvotes: 3

Abd Abughazaleh
Abd Abughazaleh

Reputation: 5595

Check if you are not in project directory and try

ionic serve 

And If you found file named ionic.project rename it to ionic.config.json

Upvotes: 0

M J
M J

Reputation: 1

Make sure your node version is above v6. Then in the root of your ionic project run ionic info.

It should give you a prompt something like "Looks like this is an Ionic Angular project, would you like to install @ionic/cli-plugin-ionic-angular and continue?"

Type yes

It should have ran the following command for you: npm install --save-dev --save-exact @ionic/cli-plugin-ionic-angular@latest

Now you can run ionic serve and it will work.

p.s above is from my experience, had the same issue and the above sorted it out. Hope this is useful.

Upvotes: 0

codeprime
codeprime

Reputation: 1

I tried this and i was able to resolve my own issue with the ionic.config.json file. Try to update your graceful-fs file by running this command:

npm install -g graceful-fs graceful-fs@latest. 

After running the command, try to create your project again by running the ionic start myApp. Where 'myApp is the name of the folder you want created for your project. This should work for you.

Upvotes: 0

JetSet
JetSet

Reputation: 189

I had the same issue here is what I did.

Mac steps

  1. sudo npm install npm -g
  2. sudo npm install -g cordova
  3. Restart your computer also. I was receiving deprecated [email protected] warnings prior to the restart.

Windows steps

  1. Redownload Node.js by going to here
  2. After download npm and Node.js will be updated as they are packaged together in the download.
  3. sudo npm install -g cordova in Command prompt window.
  4. Run cordova --version to make sure you are all set

  5. Restart your computer.

This should resolve the issue hopefully.

Upvotes: 0

Rohit Dhiman
Rohit Dhiman

Reputation: 2741

I think your first machine have ionic version < 2.0.0, the other one >= 2.0.0

If you found file named ionic.project rename it to ionic.config.json

Hope this will help you.

Upvotes: 7

Shubhranshu
Shubhranshu

Reputation: 521

I would suggest you to start the fresh installation. And remove existing cordova and ionic

install cordova & ionic with npm install -g cordova ionic

Then install the template ionic start --v2 myApp tabs Check out this link https://ionicframework.com/getting-started/

Upvotes: 0

Harrisss
Harrisss

Reputation: 363

As per logs you are getting Cordova CLI: undefined. Seems like an issue with CLI installation. Try reinstalling and that should solve your problem.

Upvotes: 0

IftekharDani
IftekharDani

Reputation: 3729

install ionic using.

npm install -g ionic@latest

or

refer link : http://ionicframework.com/docs/guide/installation.html

Upvotes: 0

Hiraqui
Hiraqui

Reputation: 447

After creating your new project, you need to step into the projects folder, in there you will find the config file and you can run ionic serve.

$ ionic start myApp tabs
$ cd myApp
$ ionic serve

Be sure that you are running last version of ionic and cordova.

Upvotes: 0

Related Questions