Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.9.0 doesn't work with minimal example #161

Closed
hugocorbucci opened this issue Jan 15, 2015 · 10 comments
Closed

Version 0.9.0 doesn't work with minimal example #161

hugocorbucci opened this issue Jan 15, 2015 · 10 comments

Comments

@hugocorbucci
Copy link

Tried creating a simple grunt-contrib-connect example and having errors.
Check this sample project: https://github.com/hugocorbucci/grunt-connect-example

Works for 0.8.0 but breaks for 0.9.0 with the following error:

$ grunt
Running "connect:server" (connect) task
Warning: Object function createServer() {
  function app(req, res, next){ app.handle(req, res, next); }
  merge(app, proto);
  merge(app, EventEmitter.prototype);
  app.route = '/';
  app.stack = [];
  return app;
} has no method 'static' Use --force to continue.

Aborted due to warnings.
@johannesspohr
Copy link

+1

1 similar comment
@ghost
Copy link

ghost commented Feb 4, 2015

+1

@johannesspohr
Copy link

The problem seems to be that it's not compatible with connect 3 (static is now serve-static), The dependency is correct in the package.json, but since express was already in my project in version 3, npm did not install it for grunt-contrib-connect i guess.

@hayesmaker
Copy link

+1

@conanmy
Copy link

conanmy commented Jul 30, 2015

+1 anyone solved this?

@vladikoff
Copy link
Member

fixed in 0.11.0

@samsong8610
Copy link

@vladikoff v0.11.2 still has this issue.

$ npm list grunt-contrib-connect
yeoman@ /home/sam/sandbox/js/yeoman
└── grunt-contrib-connect@0.11.2 

$ grunt serve
Running "serve" task

Running "clean:server" (clean) task

1 path cleaned.

Running "wiredep:app" (wiredep) task

Running "wiredep:test" (wiredep) task

Running "concurrent:server" (concurrent) task

Running "copy:styles" (copy) task
Copied 1 file

Done, without errors.


Execution Time (2015-09-15 01:11:50 UTC)
loading tasks               219ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 89%
loading grunt-contrib-copy   15ms  ▇▇▇ 6%
copy:styles                  11ms  ▇▇ 4%
Total 246ms

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

Running "connect:livereload" (connect) task
Warning: Object function createServer() {
function app(req, res, next){ app.handle(req, res, next); }
merge(app, proto);
merge(app, EventEmitter.prototype);
app.route = '/';
app.stack = [];
return app;
} has no method 'static' Use --force to continue.

Aborted due to warnings.

Execution Time (2015-09-15 01:11:49 UTC)
loading tasks 185ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 15%
wiredep:app 179ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 14%
wiredep:test 13ms ▇▇ 1%
concurrent:server 551ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 45%
loading grunt-autoprefixer 228ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 18%
autoprefixer:server 52ms ▇▇▇▇▇ 4%
Total 1.2s

@hilteci
Copy link

hilteci commented Sep 17, 2015

I have this exact problem as well, and I've now tested it on all the 0.11.x versions. The serve-static issue seems to be resolved as of 0.11.13 (and stays that way all the way through 0.12.x), but then I get:

Running "connect:development" (connect) task
Warning: undefined is not a function Use --force to continue.

I can't figure out what's causing this either. Anyone solved a undefined is not a function issue like this using grunt connect and node 0.11.13 or higher?

@samsong8610
Copy link

The project generated from yo 1.4.8 use grunt-contrib-connect@0.9.0, import dependency to connect@2.30.2. This version connect support connect().static() method. In the Gruntfile.js, yo configure a middleware for connect:livereload, in which static() method was used.
But after installed grunt-contrib-connect@0.12.2, which depends on connect@3, the middleware code generated by yo is broken.
I think this issue should be resolved by yeoman guys.

@acedesigns
Copy link

Hi Guys.

I was having the same problem, and I found a solution by doing the following. Even though I kow its not the right way of doing it. I was pressed for time. So I down graded grunt-contrib-connect from 0.11.0 to 0.8.0. Which is a big jump.

Package.json

{
 "name" : "myApp",
 "dependencies" : {
   "grunt": "0.4.5",
   "grunt-contrib-connect" : "0.8.0",
   "grunt-contrib-watch"      : "0.6.0",
   "grunt-wiredep"        : "1.9.0"    
 }
}

Gruntfile.js

module.exports = function(grunt) {
  grunt.initConfig({
   //My Tasks
  });

grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    grunt.task.run([
      'wiredep',
      'connect:livereload',
      'watch'
    ]);
  });
};

Now I can run my grunt serve with no problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants