grunt服务运行但页面没有服务[离子项目]

时间:2015-09-30 14:50:49

标签: gruntjs ionic yeoman

我在新生成的空白离子项目中遇到的问题是“grunt serve'对于它的所有任务都没有问题,它甚至可以启动" ionic:serve"任务,但奇怪的是,当我被指向' http://localhost:8100/'页面说:无法连接。 当我运行离子服务'在该文件夹中,index.html页面已打开。 奇怪。即使我跑了咕噜叫--verbose'我看到没有可以报告任何问题的行,但是没有发布“离子服务”#39;明确地说,我无法获得服务器/页面。

你能说明问题或我应该在哪里看看吗?

它是自耕农的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"
  ]
}

grunt发球输出:

$ 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

谢谢!

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

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

有时它也会发生在我身上。