blai / grunt-express

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

grunt-express giving me multiple errors and SASS not compiling #51

Open siddhion opened 10 years ago

siddhion commented 10 years ago

I started a Foundation 5 project and added grunt-express to my Gruntfile.js. Here is what it looks like:

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    sass: {
      options: {
        includePaths: ['bower_components/foundation/scss']
      },
      dist: {
        options: {
          outputStyle: 'compressed'
        },
        files: {
          'css/app.css': 'scss/app.scss'
        }        
      }
    },

    watch: {
      options: { livereload: true},
      grunt: { files: ['Gruntfile.js'] },
      sass: {
        files: 'scss/**/*.scss',
        tasks: ['sass']
      }
    },

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

  });

  grunt.loadNpmTasks('grunt-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-express');

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

And so when I run grunt-server all seems well on the command line

$ grunt server
Running "express:all" (express) task

Running "express-server:all" (express-server) task
Web server started on port:9000, hostname: localhost [pid: 1311]

Running "watch" task
Waiting...

One problem in the browser is that the app.css file is not getting served however I see that the app.scss is getting compiled into app.css.

The other bigger problem is when I refresh my browser I see the unstyled content in the window but I get the following errors in the console :

Error: Forbidden
    at SendStream.error (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:145:16)
    at SendStream.pipe (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:310:52)
    at Object.static (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/middleware/static.js:84:8)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Object.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect-livereload/index.js:53:14)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Function.app.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:198:3)
    at Server.app (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/connect.js:65:37)
    at Server.EventEmitter.emit (events.js:98:17)
    at HTTPParser.parser.onIncoming (http.js:2108:12)
Error: Forbidden
    at SendStream.error (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:145:16)
    at SendStream.pipe (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:310:52)
    at Object.static (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/middleware/static.js:84:8)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Object.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect-livereload/index.js:53:14)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Function.app.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:198:3)
    at Server.app (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/connect.js:65:37)
    at Server.EventEmitter.emit (events.js:98:17)
    at HTTPParser.parser.onIncoming (http.js:2108:12)
Error: Forbidden
    at SendStream.error (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:145:16)
    at SendStream.pipe (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:310:52)
    at Object.static (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/middleware/static.js:84:8)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Object.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect-livereload/index.js:53:14)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Function.app.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:198:3)
    at Server.app (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/connect.js:65:37)
    at Server.EventEmitter.emit (events.js:98:17)
    at HTTPParser.parser.onIncoming (http.js:2108:12)
Error: Forbidden
    at SendStream.error (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:145:16)
    at SendStream.pipe (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:310:52)
    at Object.static (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/middleware/static.js:84:8)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Object.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect-livereload/index.js:53:14)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Function.app.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:198:3)
    at Server.app (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/connect.js:65:37)
    at Server.EventEmitter.emit (events.js:98:17)
    at HTTPParser.parser.onIncoming (http.js:2108:12)
Error: Forbidden
    at SendStream.error (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:145:16)
    at SendStream.pipe (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:310:52)
    at Object.static (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/middleware/static.js:84:8)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Object.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect-livereload/index.js:53:14)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Function.app.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:198:3)
    at Server.app (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/connect.js:65:37)
    at Server.EventEmitter.emit (events.js:98:17)
    at HTTPParser.parser.onIncoming (http.js:2108:12)
Error: Forbidden
    at SendStream.error (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:145:16)
    at SendStream.pipe (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/node_modules/send/lib/send.js:310:52)
    at Object.static (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/middleware/static.js:84:8)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Object.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect-livereload/index.js:53:14)
    at next (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:190:15)
    at Function.app.handle (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/proto.js:198:3)
    at Server.app (/home/max/dev/siddhion/node_modules/grunt-express/node_modules/connect/lib/connect.js:65:37)
    at Server.EventEmitter.emit (events.js:98:17)
    at HTTPParser.parser.onIncoming (http.js:2108:12)

Any idea why I'm getting all these Express related errors? Also how come my app.css is not getting served?

blai commented 10 years ago

It is unclear to me why those error message would come up, but would you mind trying the updated version of grunt-express to see if it helps?