【问题标题】:Why www folder is empty for application created using Ionic2为什么使用 Ionic2 创建的应用程序的 www 文件夹为空
【发布时间】:2016-11-18 18:36:01
【问题描述】:

我使用命令创建了一个 Ionic2 应用程序:

离子启动 rahul --v2

在那之后 cd 拉胡尔
离子服务

但它在浏览器上显示错误: 错误:ENOENT:没有这样的文件或目录,打开'/usr/local/n/versions/node/7.0.0/rahul/www/index.html'

然后我检查了 www 文件夹,发现除了一个名为 .gitkeep 的文件之外什么都没有。

npm -v = 3.10.8
节点 -v = v7.0.0
科尔多瓦 -v = 6.4.0
离子 -v = 2.1.0-beta.3

包.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.3",
    "ionic-native": "2.2.3",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.45",
    "typescript": "2.0.6"
  },
  "description": "jain: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": []
}

【问题讨论】:

  • 尝试更新您的 ionic cli,然后创建一个新的
  • npm -v = 3.10.8,节点 -v = v7.0.0,cordova -v = 6.4.0,离子 -v = 2.1.0-beta.3
  • @Rahul 检查我在上面的评论中提出的问题,这个问题有一个临时解决方案,祝你好运
  • @mohan 临时答案在哪里?为什么是临时的?

标签: ionic-framework ionic2


【解决方案1】:

如下所示更新您的 package.json,以便 ionic serve 正常工作 这里script 对象被更改,然后一切都按预期工作。 但我仍在研究为什么它不会自动更新。

看看这个链接http://blog.ionic.io/improvements-to-ionic-build-process/

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "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"
  },
  "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.3",
    "ionic-native": "2.2.3",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.45",
    "typescript": "2.0.6"
  },
  "description": "ionic1: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": []
}

【讨论】:

    【解决方案2】:

    我的 Ionic2 安装出了点问题。

    如果您已经安装了 ionic,这里是安装 ionic2 的步骤。 更新节点 更新 npm

    那么最重要的是同时更新 ionic 和 cordova,例如: npm install -g ionic cordova

    我犯的错误是:我一一安装了ionic和cordova。

    【讨论】:

      猜你喜欢
      • 2020-05-10
      • 1970-01-01
      • 2014-08-18
      • 2011-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-22
      相关资源
      最近更新 更多