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. 基于CSS UI开源框架汇总

    从16年数据统计就有20几款UI框架出现在市面上,至今为止能统计的框架应该有40款左右了.前端框架都是基于HMTL5.CSS.JS开发的,这里主要给大家聊一下CSS UI开源框架有哪些?以后工作中选择 ...

  2. LCA问题第二弹

    LCA问题第二弹 上次用二分的方法给大家分享了对 LCA 问题的处理,各位应该还能回忆起来上次的方法是由子节点向根节点(自下而上)的处理,平时我们遇到的很多问题都是正向思维处理困难而逆向思维处理比较容 ...

  3. ASP.NET Core 认证与授权[1]:初识认证

    在ASP.NET 4.X 中,我们最常用的是Forms认证,它既可以用于局域网环境,也可用于互联网环境,有着非常广泛的使用.但是它很难进行扩展,更无法与第三方认证集成,因此,在 ASP.NET Cor ...

  4. Springmvc学习笔记(一)

    一.sprinvmvc的介绍 1.1.Spring MVC属于SpringFrameWork的后续产品,已经融合在Spring Web Flow里面.Spring 框架提供了构建 Web 应用程序的全 ...

  5. Paint the Grid Again ZOJ - 3780 拓扑

    Paint the Grid Again Time Limit: 2000MS   Memory Limit: 65536KB   64bit IO Format: %lld & %llu [ ...

  6. spring 内部工作机制(二)

    本章节讲Spring容器从加载配置文件到创建出一个完整Bean的作业流程及参与的角色. Spring 启动时读取应用程序提供的Bean配置信息,并在Spring容器中生成一份相应的Bean配置注册表, ...

  7. ES6-模块化

    ES6-模块化 在es6标准中,js原生支持modulele. ES6模块需要使用babel转码,这里简单解释一下什么是babel转码. babel就是将‘ES6模块化语法’转化为‘CommonJS模 ...

  8. .net通用防SQL注入漏洞程序(Global.asax方式)

    原理很简单:使用Global.asax中的Application_BeginRequest(object sender, EventArgs e)事件,实现表单或URL提交数据的获取,然后通过SQLI ...

  9. cookie存储中文

    写cookie         Cookie   chineseCookie   =   new   Cookie( "chineseCookie ",   URLEncoder. ...

  10. BZOJ-4915-简单的数字题

    Description 对任意的四个不同的正整数组成的集合A={a_1,a_2,a_3,a_4 },记S_A=a_1+a_2+a_3+a_4,设n_A是满足a_i+a_j (1 ≤i<j≤4)| ...