简体   繁体   中英

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

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.

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

I have run into the exact same issue. I updated ionic to reflect this

cmd ionic info

Cordova CLI: 6.4.0 
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
ios-deploy version: 1.9.0 
ios-sim version: 5.0.11 
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.1 Build version 8B62

Note Node version is not 7.0

Start a new project sidemenu or tabs and ionic -l or ionic serve should work.

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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM