Error: ENOENT: no such file or directory, open in ionic2

15,744

Solution 1

I was using ubuntu16.04 and i forgot to add the sudo command befor that was my issue while installing to latest one.

sudo npm install -g ionic@latest
sudo npm install @ionic/app-scripts@latest

Now everything works fine

Solution 2

I was also facing this same issue, I search here in ionic forum
https://github.com/ionic-team/ionic-cli/issues/1420 Finally i came to relized that I have to do something like this-

I was missing index.html file here-
www/index.html
I just copy and paste index file to resolve this issue-
copy form src/index.html
paste here www/index.html

hopefully that will for for you as this worked for me.

OR

another way to do is just update your local setup by following this article
http://ionicframework.com/docs/intro/installation/

if you are getting error of node compatibility while installing cordova then just do it-

$ sudo npm install n -g 

to install n to manage node version.

$ sudo n latest

to install latest version of node.

$ npm install -g ionic cordova

to install cordova.
Now Create new app-

$ ionic start cutePuppyPics   

run server-

$ cd cutePuppyPics
$ ionic serve

Hope it will help too...

Share:
15,744
Mohan Gopi
Author by

Mohan Gopi

Each and every end of the day thinking what i have learned today. And Improving my self daily as developer.

Updated on June 18, 2022

Comments

  • Mohan Gopi
    Mohan Gopi almost 2 years

    I was just creating a new project ionic start blank --v2 and the i gave ionic serve. in my browse i am getting error like below

    Error: ENOENT: no such file or directory, open '/home/panini/myApp/www/index.html'.

    this is my output for ionic serve in cmd

    Running live reload server: http://localhost:35729
    Watching: www/**/*, !www/lib/**/*, !www/**/*.map
    √ Running dev server:  http://localhost:8100
    Ionic server commands, enter:
      restart or r to restart the client app from the root
      goto or g and a url to have the app navigate to the given url
      consolelogs or c to enable/disable console log output
      serverlogs or s to enable/disable server log output
      quit or q to shutdown the server and exit
    
    ionic $ 
    

    I dont find any gulp file watch in my ionic serve

    here is my package.json file

    {
      "name": "ionic-hello-world",
      "author": "Ionic Framework",
      "homepage": "http://ionicframework.com/",
      "private": true,
      "scripts": {
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
      },
      "dependencies": {
        "@angular/common": "2.1.1",
        "@angular/compiler": "2.1.1",
        "@angular/compiler-cli": "2.1.1",
        "@angular/core": "2.1.1",
        "@angular/forms": "2.1.1",
        "@angular/http": "2.1.1",
        "@angular/platform-browser": "2.1.1",
        "@angular/platform-browser-dynamic": "2.1.1",
        "@angular/platform-server": "2.1.1",
        "@ionic/storage": "1.1.6",
        "ionic-angular": "2.0.0-rc.2",
        "ionic-native": "2.2.3",
        "ionicons": "3.0.0",
        "rxjs": "5.0.0-beta.12",
        "zone.js": "0.6.21"
      },
      "devDependencies": {
        "@ionic/app-scripts": "0.0.43",
        "typescript": "2.0.6"
      },
      "description": "myApp: An Ionic project",
      "cordovaPlugins": [
        "cordova-plugin-device",
        "cordova-plugin-console",
        "cordova-plugin-whitelist",
        "cordova-plugin-splashscreen",
        "cordova-plugin-statusbar",
        "ionic-plugin-keyboard"
      ],
      "cordovaPlatforms": []
    }
    

    here is my ionic info result

    Your system information:
    
    Cordova CLI: 6.3.0
    Ionic Framework Version: 2.0.0-rc.2
    Ionic CLI Version: 2.1.0
    Ionic App Lib Version: 2.1.0-beta.1
    OS: Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS 
    Node Version: v6.0.0
    

    Note

    According this https://github.com/driftyco/ionic-cli/issues/1420 discussion my script object in the package.json is not matching when i update with this below object it is working

    "scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build"
    }
    

    Question:

    On giving ionic start myApp blank --v2 i am not able to generate package.json correctly.

    http://blog.ionic.io/improvements-to-ionic-build-process/ according to this blog i tried still no better output.