angular - 在 ionic2 中打开时出现错误 : ENOENT: no such file or directory,

标签 angular ionic2 package.json

我刚刚创建一个新项目ionic start Blank --v2并且我给出了ionicserve。在我的浏览中我收到如下错误

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

这是我在 cmd 中对 ionicserve 的输出

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 服务中没有找到任何 gulp 文件 watch

这是我的 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": []
}

这是我的 ionic 信息结果

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.

最佳答案

我使用的是 ubuntu16.04,但我忘记添加 sudo 命令,因为这是我在安装到最新版本时遇到的问题。

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

现在一切正常

关于angular - 在 ionic2 中打开时出现错误 : ENOENT: no such file or directory,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40669878/

相关文章:

javascript - 使用嵌套数组对象迭代数组的属性

angular - 没有提供 ActivatedRoute - Angular 2 RC5

node.js - 如何使用Yarn全局安装本地包?

Angular 2获取动态FormGroup名称

android - "ionic cordova run android"不适用于 cordova-android@7.0.0

javascript - 如何使用 nav.popTo() (ionic 2)?

cordova - 添加 MobileFirst 插件时,为 Windows 10 构建 ionic 应用程序失败

npm - 如何使用 package.json 中的 'files' 和 'directories' 属性?

npm - 如何使用新的 npm 功能发布私有(private)模块?

javascript - 使用 JavaScript 或 Angular CLI 将视频文件作为 blob 上传到 AWS S3