grunt服务器无法连接< gruntjs> [英] grunt server can't be connected <gruntjs>
本文介绍了grunt服务器无法连接< gruntjs>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
module.exports = function(grunt){
//项目配置。
grunt.initConfig({
server:{
port:8888,
ase:'。'
}
});
};
C:\程序文件\\\
odejs\test\grunt>
C:\程序文件\\\
odejs\test\grunt> grunt服务器
运行服务器任务
在端口8888上启动静态web服务器。
$ b完成,没有错误。
但无法通过输入
[http://127.0.0.1:8888] [1]在浏览器中! jiang〜
如何在windows或unix中解决这个问题?
解决方案在grunt 0.4中加入了 grunt-contrib-connect 你可以使用
keepalive
参数来运行长时间运行的服务器:grunt connect:target:keepalive
或者将其定义为您的配置中有一个选项:grunt.initConfig({
connect:{
target:{
选项:{
port:9001,
keepalive:true
}
}
}
});
module.exports = function(grunt) { // Project configuration. grunt.initConfig({ server: { port: 8888, base: '.' } }); }; C:\Program Files\nodejs\test\grunt> C:\Program Files\nodejs\test\grunt>grunt server Running "server" task Starting static web server on port 8888.
Done, without errors.
but can't connected by input
[http://127.0.0.1:8888][1] in browsers ! jiong~
How about to fix this problem in windows or unix ?
解决方案In grunt 0.4 combined with grunt-contrib-connect you can run a long running server by using the
keepalive
argument:grunt connect:target:keepalive
or define it as an option in your config:grunt.initConfig({ connect: { target:{ options: { port: 9001, keepalive: true } } } });
这篇关于grunt服务器无法连接< gruntjs>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文