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

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

我刚刚创建了一个新项目 ionic start blank --v2,我给了 ionic serve。在我的浏览器中,出现如下错误

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

这是我在 cmd

ionic serve 的输出
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 $ 

我在我的 ionic serve 中找不到任何 gulp 文件监视

这是我的 package.json 文件

{
  "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": []
}

这是我的离子信息结果

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

备注

根据这个 https://github.com/driftyco/ionic-cli/issues/1420 讨论,我在 package.json 中的脚本对象不匹配,当我更新这个下面的对象时它正在工作

"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"
}

问题:

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.

我 运行 遇到了完全相同的问题。我更新了 ionic 以反映这一点

命令离子信息

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

注意Node版本不是7.0

开始一个新项目 sidemenutabs 并且 ionic -l 或 ionic serve 应该可以工作。

我使用的是 ubuntu 16.04,我在安装到最新版本时忘记添加 sudo 命令,这是我的问题。

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

现在一切正常

我也遇到了同样的问题,我在ionic论坛上搜索
https://github.com/ionic-team/ionic-cli/issues/1420 最后我意识到我必须做这样的事情-

我在这里丢失了 index.html 文件-
www/index.html
我只是复制并粘贴索引文件来解决这个问题-
复制表格 src/index.html
粘贴到这里 www/index.html

希望这对你有用,因为这对我有用。

OR

另一种方法是按照这篇文章更新您的本地设置
http://ionicframework.com/docs/intro/installation/

如果您在安装 cordova 时遇到节点兼容性错误,那么就这样做 -

$ sudo npm install n -g 

安装n来管理节点版本。

$ sudo n latest

安装最新版本的节点。

$ npm install -g ionic cordova

安装cordova。
现在创建新应用-

$ ionic start cutePuppyPics   

运行 服务器-

$ cd cutePuppyPics
$ ionic serve

希望它也能有所帮助...