grunt serve 运行但页面未服务 [ionic project]

grunt serve runs but page not served [ionic project]

我在新生成的空白离子项目中遇到的问题是 'grunt serve' 运行 的所有任务都没有问题,它甚至启动了 "ionic:serve" 任务,但奇怪的是当我被定向到“http://localhost:8100/”页面时说:无法连接。 当我在文件夹中运行 'ionic serve'时,index.html页面打开。 奇怪的。即使当我 运行 'grunt serve --verbose' 时,我也看不到任何可以报告任何问题的行,但是如果没有明确发出 'ionic serve',我就无法打开 server/page。

你能告诉我可能是什么问题或我应该去哪里找吗?

这是 yeoman 生成的 ionic 项目。

ionic.project:

{
  "name": "yo",
  "app_id": "",
  "watchPatterns": ["www/**/*"]
}

package.json:

{
  "name": "TxOffice",
  "version": "0.0.0",
  "private": true,
  "dependencies": {},
  "devDependencies": {
    "grunt": "~0.4.5",
    "glob": "~4.3.5",
    "grunt-autoprefixer": "~2.2.0",
    "grunt-wiredep": "^2.0.0",
    "ionic": "^1.3.7",
    "grunt-concurrent": "~1.0.0",
    "grunt-contrib-clean": "~0.6.0",
    "grunt-contrib-concat": "~0.5.0",
    "grunt-contrib-connect": "~0.9.0",
    "grunt-contrib-copy": "~0.7.0",
    "grunt-contrib-cssmin": "~0.11.0",
    "grunt-contrib-htmlmin": "~0.3.0",
    "grunt-contrib-jshint": "~0.11.0",
    "grunt-contrib-uglify": "~0.7.0",
    "grunt-contrib-watch": "~0.6.1",
    "grunt-newer": "~1.1.0",
    "grunt-usemin": "~3.0.0",
    "grunt-ng-annotate": "~0.9.2",
    "grunt-ng-constant": "^1.0.0",
    "jshint-stylish": "~1.0.0",
    "load-grunt-tasks": "~3.1.0",
    "time-grunt": "~1.0.0",
    "cordova": "~4.2.0",
    "lodash": "~3.1.0",
    "mkdirp": "~0.5.0",
    "ncp": "~1.0.1",
    "orchestrator": "~0.3.7",
    "ripple-emulator": "~0.9.24",
    "elementtree": "0.1.6",
    "plist": "1.1.0",
    "win-spawn": "^2.0.0"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "test": "grunt test"
  },
  "cordovaPlugins": [
    "org.apache.cordova.device",
    "org.apache.cordova.console",
    "com.ionic.keyboard",
    "org.apache.cordova.device",
    "org.apache.cordova.console",
    "com.ionic.keyboard",
    "com.ionic.keyboard",
    "org.apache.cordova.console",
    "org.apache.cordova.console",
    "org.apache.cordova.device",
    "com.ionic.keyboard",
    "org.apache.cordova.console",
    "org.apache.cordova.console",
    "org.apache.cordova.console",
    "org.apache.cordova.device",
    "org.apache.cordova.console",
    "com.ionic.keyboard"
  ],
  "cordovaPlatforms": [
    "android"
  ]
}

g运行t 服务输出:

$ grunt serve
Running "serve" task

Running "wiredep:app" (wiredep) task

Running "clean:dist" (clean) task
>> 16 paths cleaned.

Running "clean:server" (clean) task
>> 0 paths cleaned.

Running "ngconstant:development" (ngconstant) task
Creating module config at app/scripts/configuration.js...OK

Running "wiredep:app" (wiredep) task

Running "concurrent:server" (concurrent) task

    Running "copy:fonts" (copy) task
    Copied 4 files

    Done, without errors.


    Execution Time (2015-09-30 14:48:28 UTC)
    loading tasks   8ms  ▇▇▇▇▇▇▇▇▇▇▇ 22%
    copy:fonts     28ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 76%
    Total 37ms

    Running "copy:styles" (copy) task
    Copied 2 files

    Done, without errors.


    Execution Time (2015-09-30 14:48:28 UTC)
    loading tasks   5ms  ▇▇▇▇▇▇▇▇▇▇ 21%
    copy:styles    19ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 79%
    Total 24ms

    Running "copy:vendor" (copy) task


    Done, without errors.


    Execution Time (2015-09-30 14:48:28 UTC)
    loading tasks   5ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 33%
    copy:vendor    10ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 67%
    Total 15ms

Running "autoprefixer:dist" (autoprefixer) task
Autoprefixer's process() method is deprecated and will removed in next major release. Use postcss([autoprefixer]).process() instead
File .temp/styles/main.css created.
Autoprefixer's process() method is deprecated and will removed in next major release. Use postcss([autoprefixer]).process() instead
File .temp/styles/style.css created.

Running "newer:copy:app" (newer) task

Running "copy:app" (copy) task
Created 94 directories, copied 352 files

Running "newer-postrun:copy:app:1:/home/tepo/yo/node_modules/grunt-newer/.cache" (newer-postrun) task

Running "newer:copy:tmp" (newer) task

Running "copy:tmp" (copy) task
Copied 2 files

Running "newer-postrun:copy:tmp:2:/home/tepo/yo/node_modules/grunt-newer/.cache" (newer-postrun) task

Running "concurrent:ionic" (concurrent) task
Running "ionic:serve" (ionic) task
Running "watch" task
Waiting...
Running live reload server: http://localhost:35729
Watching : [ 'www/**/*' ]
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 $ 
Done, without errors.


Execution Time (2015-09-30 14:48:30 UTC)
ionic:serve  1.7s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 100%
Total 1.7s

甚至无法访问实时重载服务器http://localhost:35729

谢谢!

issue 与 grunt-concurrent。 到目前为止,最新版本 (2.0.3) 无法正常工作。需要恢复到 1.0.0

在浏览器中创建新选项卡并在 URL 中键入 localhost:8100 并按 Enter 它将起作用。

有时候我也会这样。