grunt-contrib-connect从0.11.x版本开始不支持connect.static和connect.directory

你应该安装serve-static(加载静态文件)和serve-index(加载目录)

npm install --save-dev grunt-contrib-connect serve-static 

使用例子

var serveStatic = require('serve-static');
var serveIndex = require('serve-index');

grunt.initConfig({
connect: {
options: {
test: {
directory: 'somePath',
middleware: function(connect, options){
var _staticPath = path.resolve(options.directory);
return [serveStatic(_staticPath), serveIndex(_staticPath)]
}
}
}
}
})



参考链接http://stackoverflow.com/questions/32961124/warning-connect-static-is-not-a-function-use-force-to-continue



Warning: connect.static is not a function的更多相关文章

  1. gulp connect.static is not a function

    npm install --save serve-static var serveStatic = require('serve-static');

  2. warning: control reaches end of non-void function

    用gcc编译一个程序的时候出现这样的警告: warning: control reaches end of non-void function 它的意思是:控制到达非void函数的结尾.就是说你的一些 ...

  3. 解决warning: incompatible implicit declaration of built-in function 'malloc'

    因为代码中使用了malloc函数和字符串函数.编译时出现错误 warning: incompatible implicit declaration of built-in function 'mall ...

  4. warning: incompatible implicit declaration of built-in function 'exit'

    warning: incompatible implicit declaration of built-in function 'exit' 解决方法:  在头文件里 引入 stdlib 文件, #i ...

  5. warning: control reaches end of non-void function 和 warning: implicit declaration of function 'rsgClearColor' is invalid in C99

    用gcc编译一个程序的时候出现这样的警告: warning: control reaches end of non-void function 它的意思是:控制到达非void函数的结尾.就是说你的一些 ...

  6. 【gcc】warning: control reaches end of non-void function

    用gcc编译一个C程序的时候出现这样的警告: warning: control reaches end of non-void function 它的意思是:控制到达非void函数的结尾.就是说你的一 ...

  7. bug_ warning: control reaches end of non-void function

    摘要 在leetcode上编译时,它显示我编译错误 warning: control reaches end of non-void function 它的意思是:控制到达非void函数的结尾.就是说 ...

  8. 删除: warning C4996: 'sprintf': This function or variable may be unsafe. Consider 方法

    可以使用的最简单的方法: 选项Project   |   Configuration   Properties   |   C/C++   |   Preprocessor   |   Preproc ...

  9. warning: incompatible implicit declaration of built-in function ‘exit’

    出现这个错误,一般是程序中某个函数没有include相关的文件. EG. 出现这个错误是因为要使用exit()应该包含stdlib.h文件

随机推荐

  1. Mysql中设置默认时间为当前值

    1.直接在创建表时添加该列并声明默认值,如下: CREATE TABLE `table1` ( `id` ) NOT NULL, `createtime` timestamp NULL default ...

  2. Flask-WTF CSRF 保护P3

    使用FlaskForm处理请求的任何视图函数都已经获得了CSRF保护.如果有些视图函数还在使用FlaskForm或AJAX请求,请尽快使用FlaskForm提供的CSRF扩展来保护它们. 导入 想要为 ...

  3. 翻译 | Thingking in Redux(如果你只了解MVC)

    作者:珂珂(沪江前端开发工程师) 本文原创,转载请注明作者及出处. 原文地址:https://hackernoon.com/thinking-in-redux-when-all-youve-known ...

  4. Azure Powershell使用已有Image创建ARM非托管磁盘虚拟机

    生成Image映像文件,记录好Image的URL(下面URL为测试URL,具体请参考实际):ImageURL:https://hlmrgstoragen.blob.core.chinacloudapi ...

  5. AngularJS -- Bootstrap(启动器)

    点击查看AngularJS系列目录 转载请注明出处:http://www.cnblogs.com/leosx/ Bootstrap(初始化) 这章介绍了Angular的初始化过程,以及如何在必要的时候 ...

  6. C++中const用于函数重载

    C++中const用于函数重载 常成员函数和非常成员函数之间的重载 首先先回忆一下常成员函数 声明:<类型标志符>函数名(参数表)const: 说明: (1)const是函数类型的一部分, ...

  7. GitHub Desktop客户端打开文件乱码问题解决方案

    今天在使用GitHub Desktop客户端的时候,发添加本地仓库后文件内容显示为乱码. 1.现象  如下图所示: 2.原因分析 后来分析得知原来是由于编码不统一造成 的. 具体来说,我在window ...

  8. How many Knight Placing? UVA - 11091

    How many Knight Placing? Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %l ...

  9. hdu4027 开方,记录

    A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use ...

  10. asp.net mvc 自动化测试工具

    好久不写文章了,一直忙在项目中. 前一阵发现公司一个项目,体积巨大.业务很复杂.基于历史原因,项目基于mvc 2迁移过来,视图大多还是aspx  作为视图承载. 控制器中的方法  更是一个比一个多. ...