blai / grunt-express

Start an Express.js web server using grunt.js
MIT License
254 stars 41 forks source link

Warning: Cannot call method 'map' of undefined #59

Closed azhang closed 10 years ago

azhang commented 10 years ago

I've just updated from 1.2.1 to 1.3.4. no change in config.

express: {
  options: {
    port: 3000
  },
  livereload: {
    options: {
      livereload: true,
      server: path.resolve('server/index.js'),
      showStack: true
    }
  }
}
blai commented 10 years ago

you need to define the https://github.com/blai/grunt-express#bases options when you want to do livereload, this is for the plugin to know the set of files to watch for livereloading.

However, livereload may not work right now anyway due to some limitation on grunt-contrib-watch.

azhang commented 10 years ago

Ah, gotcha. Thanks.

trisys3 commented 10 years ago

So, just to be sure, if we define the "bases" option, it will not hijack the "express.static()" middleware we already have in our server, right? The documentation did not make this clear.

azhang commented 10 years ago

Correct.— Sent from Mailbox

On Mon, Jun 9, 2014 at 12:31 AM, trisys3 notifications@github.com wrote:

So, just to be sure, if we define the "bases" option, it will not hijack the "express.static()" middleware we already have in our server, right?

Reply to this email directly or view it on GitHub: https://github.com/blai/grunt-express/issues/59#issuecomment-45460475

Zigson commented 9 years ago

Hi, I am also getting this error:

Running "express:all" (express) task Warning: Cannot call method 'map' of undefined Use --force to continue.

Can you please point me to a solution, I am new to Grunt and kind of don't understand how/what to define in bases.

Here is my configuration in gruntfile.js

        express: {
            all: {
                options: {
                    port: 9000,
                    hostname: 'localhost',
                    base: ['.'],
                    livereload: true
                }
            }
        }

    grunt.registerTask('server', ['express', 'watch']);
}

Thanks.

trisys3 commented 9 years ago

Zigson, the option name is "bases", not "base". However, this may not be your only problem.

Zigson commented 9 years ago

Sean, thanks for pointing this out. Will try further on.