My problem is similar to the following: Grunt does not load node server
However, the answers do not solve the problem in my case. Here is my grunt file:
'use strict';
module.exports = function(grunt) {
var watchFiles = {
serverViews: ['app/views/**/*.*'],
serverJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js'],
clientViews: ['public/modules/**/views/**/*.html'],
clientJS: ['public/js/*.js', 'public/modules/**/*.js'],
clientCSS: ['public/modules/**/*.css', 'public/lib/bootstrap/dist/css/icomoon.css'],
mochaTests: ['app/tests/**/*.js']
};
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
serverViews: {
files: watchFiles.serverViews,
options: {
livereload: true
}
},
serverJS: {
files: watchFiles.serverJS,
tasks: ['jshint'],
options: {
livereload: true
}
},
clientViews: {
files: watchFiles.clientViews,
options: {
livereload: true,
}
},
clientJS: {
files: watchFiles.clientJS,
tasks: ['jshint'],
options: {
livereload: true
}
},
clientCSS: {
files: watchFiles.clientCSS,
tasks: ['csslint'],
options: {
livereload: true
}
}
},
jshint: {
all: {
src: watchFiles.clientJS.concat(watchFiles.serverJS),
options: {
jshintrc: true
}
}
},
csslint: {
options: {
csslintrc: '.csslintrc',
},
all: {
src: watchFiles.clientCSS
}
},
uglify: {
production: {
options: {
mangle: false
},
files: {
'public/dist/application.min.js': 'public/dist/application.js'
}
}
},
cssmin: {
combine: {
files: {
'public/dist/application.min.css': '<%= applicationCSSFiles %>'
}
}
},
nodemon: {
dev: {
script: 'server.js',
options: {
file: 'server.js',
nodeArgs: ['--debug'],
ext: 'js,html',
watch: watchFiles.serverViews.concat(watchFiles.serverJS)
}
}
},
'node-inspector': {
custom: {
options: {
'web-port': 1337,
'web-host': 'localhost',
'debug-port': 5858,
'save-live-edit': true,
'no-preload': true,
'stack-trace-limit': 50,
'hidden': []
}
}
},
ngAnnotate: {
production: {
files: {
'public/dist/application.js': '<%= applicationJavaScriptFiles %>'
}
}
},
concurrent: {
default: ['nodemon', 'watch'],
debug: ['nodemon', 'watch', 'node-inspector'],
options: {
logConcurrentOutput: true,
limit: 10
}
},
env: {
test: {
NODE_ENV: 'test'
},
secure: {
NODE_ENV: 'secure'
}
},
mochaTest: {
src: watchFiles.mochaTests,
test: {
options: {
require: 'server.js',
reporter: 'spec'
}
}
},
karma: {
unit: {
configFile: 'karma.conf.js'
}
}
});
require('load-grunt-tasks')(grunt);
grunt.option('force', true);
grunt.task.registerTask('loadConfig', 'Task that loads the config into a grunt option.', function() {
var init = require('./config/init')();
var config = require('./config/config');
grunt.config.set('applicationJavaScriptFiles', config.assets.js);
grunt.config.set('applicationCSSFiles', config.assets.css);
});
grunt.registerTask('default', ['lint', 'concurrent:default']);
grunt.registerTask('debug', ['lint', 'concurrent:debug']);
grunt.registerTask('secure', ['env:secure', 'lint', 'concurrent:default']);
grunt.registerTask('lint', ['jshint', 'csslint']);
grunt.registerTask('build', ['lint', 'loadConfig', 'ngAnnotate', 'uglify', 'cssmin']);
grunt.registerTask('test', ['env:test', 'mochaTest', 'karma:unit']);
grunt.registerTask('test-front', ['env:test', 'karma:unit']);
grunt.registerTask('test-back', ['env:test', 'mochaTest']);
};
When I run grunt (ignoring lint errors), I get:
Running "concurrent:default" (concurrent) task
Running "watch" task
Running "nodemon:dev" (nodemon) task
Waiting...
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/views*.* gruntfile.js server.js config*.js app*.js
[nodemon] starting `node --debug server.js`
And it just stops ... Usually it will say that the MEANjs application has started on localhost: 3000, and when I open the application in the browser, it will show a huge list of files as they are requested and downloaded through the browser.
This is the version of grunt -v (there are too many files viewed, so I deleted some for clarity and brevity):
Running "nodemon" task
Running "nodemon:dev" (nodemon) task
Verifying property nodemon.dev exists in config...OK
File: [no files]
Options: file="server.js", nodeArgs=["--debug"], ext="js,html", watch=["app/views/**/*.*","gruntfile.js","server.js","config/**/*.js","app/**/*.js"]
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/views*.* gruntfile.js server.js config*.js app*.js
[nodemon] starting `node --debug server.js`
Loading "grunt-karma.js" tasks...OK
+ karma
Loading "gruntfile.js" tasks...OK
+ build, debug, default, lint, loadConfig, secure, test, test-back, test-front
Running tasks: watch
Running "watch" task
Waiting...
Verifying property watch exists in config...OK
Verifying property watch.serverViews.files exists in config...OK
Verifying property watch.serverJS.files exists in config...OK
Verifying property watch.clientViews.files exists in config...OK
Verifying property watch.clientJS.files exists in config...OK
Verifying property watch.clientCSS.files exists in config...OK
Live reload server started on port: 35729
Watching app/views/404.server.view.html for changes.
Watching app/views/templates for changes.
Watching app/views/500.server.view.html for changes.
Watching app/views/index.server.view.html for changes.
Watching app/views/layout.server.view.html for changes.
Watching app/views/templates/reset-password-confirm-email.server.view.html for changes.
Watching app/views/templates/reset-password-email.server.view.html for changes.
Watching gruntfile.js for changes.
Watching .git for changes.
Watching app for changes.
Watching config for changes.
Watching node_modules for changes.
Watching public for changes.
Watching server.js for changes.
Watching config/config.js for changes.
Watching config/env for changes.
Watching config/strategies for changes.
Watching config/express.js for changes.
Watching config/init.js for changes.
Watching config/passport.js for changes.
Watching config/env/all.js for changes.
Watching config/env/development.js for changes.
Watching config/env/production.js for changes.
Watching config/env/secure.js for changes.
Watching config/env/test.js for changes.
Watching config/strategies/facebook.js for changes.
Watching config/strategies/github.js for changes.
Watching config/strategies/google.js for changes.
Watching config/strategies/linkedin.js for changes.
Watching config/strategies/local.js for changes.
Watching config/strategies/twitter.js for changes.
Watching app/controllers/alerts.server.controller.js for changes.
Watching app/controllers/users for changes.
Watching app/controllers/bundles.server.controller.js for changes.
Watching app/controllers/configurations.server.controller.js for changes.
Watching app/controllers/core.server.controller.js for changes.
Watching app/controllers/devices.server.controller.js for changes.
Watching app/controllers/errors.server.controller.js for changes.
Watching app/controllers/invitations.server.controller.js for changes.
Watching app/controllers/orders.server.controller.js for changes.
Watching app/controllers/projects.server.controller.js for changes.
Watching app/controllers/readings.server.controller.js for changes.
Watching app/controllers/services.server.controller.js for changes.
Watching app/controllers/users.server.controller.js for changes.
Watching app/controllers/users/users.authentication.server.controller.js for changes.
Watching app/controllers/users/users.authorization.server.controller.js for changes.
Watching app/controllers/users/users.list.server.controller.js for changes.
Watching app/controllers/users/users.password.server.controller.js for changes.
Watching app/controllers/users/users.profile.server.controller.js for changes.
Watching app/models/alert.server.model.js for changes.
Watching app/models/bundle.server.model.js for changes.
Watching app/models/configuration.server.model.js for changes.
Watching app/models/device.server.model.js for changes.
Watching app/models/invitation.server.model.js for changes.
Watching app/models/order.server.model.js for changes.
Watching app/models/project.server.model.js for changes.
Watching app/models/reading.server.model.js for changes.
Watching app/tests/order.server.routes.test.js for changes.
Watching app/tests/project.server.model.test.js for changes.
Watching app/tests/project.server.routes.test.js for changes.
Watching app/tests/reading.server.model.test.js for changes.
Watching app/tests/reading.server.routes.test.js for changes.
Watching app/tests/user.server.model.test.js for changes.
Watching public/modules/alerts/views/create-alert.client.view.html for changes.
Watching public/modules/bundles/views/edit-bundle.client.view.html for changes.
Watching public/modules/bundles/views/list-bundles.client.view.html for changes.
Watching public/modules/bundles/views/view-bundle.client.view.html for changes.
Watching public/modules/configurations/views/create-configuration.client.view.html for changes.
Watching public/modules/configurations/views/edit-configuration.client.view.html for changes.
Watching public/modules/configurations/views/list-configurations.client.view.html for changes.
Watching public/modules/configurations/views/view-configuration.client.view.html for changes.
Watching public/modules/core/views/admin-panel.client.view.html for changes.
Watching public/modules/core/views/checkout.client.view.html for changes.
Watching public/modules/core/views/dashboard.client.view.html for changes.
Watching public/modules/core/views/details.client.view.html for changes.
Watching public/modules/core/views/device-config.client.view.html for changes.
Watching public/modules/core/views/footer.client.view.html for changes.
Watching public/modules/core/views/header.client.view.html for changes.
Watching public/modules/core/views/home.client.view.html for changes.
Watching public/modules/core/views/project-panel.client.view.html for changes.
Watching public/modules/devices/views/create-device.client.view.html for changes.
Watching public/modules/devices/views/edit-device.client.view.html for changes.
Watching public/modules/devices/views/list-devices.client.view.html for changes.
Watching public/modules/devices/views/view-device.client.view.html for changes.
Watching public/modules/invitations/views/create-invitation.client.view.html for changes.
Watching public/modules/invitations/views/edit-invitation.client.view.html for changes.
Watching public/modules/invitations/views/list-invitations.client.view.html for changes.
Watching public/modules/invitations/views/view-invitation.client.view.html for changes.
Watching public/modules/orders/views/create-order.client.view.html for changes.
Watching public/modules/orders/views/edit-order.client.view.html for changes.
Watching public/modules/orders/views/list-orders.client.view.html for changes.
Watching public/modules/users/views/authentication/signin.client.view.html for changes.
Watching public/modules/users/views/authentication/signup.client.view.html for changes.
Watching public/modules/users/views/invitation/invitation-invalid.client.view.html for changes.
Watching public/modules/users/views/invitation/invitation-signup.client.view.html for changes.
Watching public/modules/users/views/password/forgot-password.client.view.html for changes.
Watching public/modules/alerts/alerts.client.module.js for changes.
Watching public/modules/alerts/config for changes.
Watching public/modules/alerts/controllers for changes.
Watching public/modules/alerts/services for changes.
Watching public/modules/alerts/tests for changes.
Watching public/modules/alerts/views for changes.
Watching public/modules/alerts/config/alerts.client.routes.js for changes.
Watching public/modules/alerts/controllers/alerts.client.controller.js for changes.
Watching public/modules/alerts/services/alerts.client.service.js for changes.
Watching public/modules/alerts/tests/alerts.client.controller.test.js for changes.
Watching public/modules/bundles/bundles.client.module.js for changes.
Watching public/modules/bundles/config for changes.
Watching public/modules/bundles/controllers for changes.
Watching public/modules/bundles/services for changes.
Watching public/modules/bundles/tests for changes.
Watching public/modules/bundles/views for changes.
Watching public/modules/bundles/config/bundles.client.routes.js for changes.
Watching public/modules/bundles/controllers/bundles.client.controller.js for changes.
Watching public/modules/bundles/services/bundles.client.service.js for changes.
Watching public/modules/bundles/tests/bundles.client.controller.test.js for changes.
Watching public/modules/chart/chart.client.module.js for changes.
Watching public/modules/chart/config for changes.
Watching public/modules/chart/controllers for changes.
Watching public/modules/chart/css for changes.
Watching public/modules/chart/directives for changes.
Watching public/modules/chart/services for changes.
Watching public/modules/chart/tests for changes.
Watching public/modules/chart/views for changes.
Watching public/modules/chart/directives/chart.directive.js for changes.
Watching public/modules/chart/services/d3.service.js for changes.
Watching public/modules/chart/tests/chart.directive.test.js for changes.
Watching public/modules/configurations/config/configurations.client.routes.js for changes.
Watching public/modules/configurations/configurations.client.module.js for changes.
Watching public/modules/configurations/config for changes.
Watching public/modules/configurations/controllers for changes.
Watching public/modules/configurations/services for changes.
Watching public/modules/configurations/tests for changes.
Watching public/modules/configurations/views for changes.
Watching public/modules/configurations/controllers/configurations.client.controller.js for changes.
Watching public/modules/configurations/services/configurations.client.service.js for changes.
Watching public/modules/configurations/tests/configurations.client.controller.test.js for changes.
Watching public/modules/core/config/core.client.routes.js for changes.
Watching public/modules/core/controllers/admin-panel.client.controller.js for changes.
Watching public/modules/core/controllers/checkout.client.controller.js for changes.
Watching public/modules/core/controllers/core.client.controller.js for changes.
Watching public/modules/core/controllers/dashboard.client.controller.js for changes.
Watching public/modules/core/controllers/device-config.client.controller.js for changes.
Watching public/modules/core/controllers/header.client.controller.js for changes.
Watching public/modules/core/controllers/home.client.controller.js for changes.
Watching public/modules/core/controllers/project-panel.client.controller.js for changes.
Watching public/modules/core/core.client.module.js for changes.
Watching public/modules/core/config for changes.
Watching public/modules/core/controllers for changes.
Watching public/modules/core/css for changes.
Watching public/modules/core/directives for changes.
Watching public/modules/core/img for changes.
Watching public/modules/core/services for changes.
Watching public/modules/core/tests for changes.
Watching public/modules/core/views for changes.
Watching public/modules/core/directives/chart.directive.js for changes.
Watching public/modules/core/services/device.assigner.service.js for changes.
Watching public/modules/core/services/device.encoder.service.js for changes.
Watching public/modules/core/services/device.storage.service.js for changes.
Watching public/modules/core/services/id.encryption.service.js for changes.
Watching public/modules/core/services/menus.client.service.js for changes.
Watching public/modules/core/services/projects.creator.service.js for changes.
Watching public/modules/core/services/projects.storage.service.js for changes.
Watching public/modules/core/tests/admin-panel.client.controller.test.js for changes.
Watching public/modules/core/tests/controllerTests for changes.
Watching public/modules/core/tests/directiveTests for changes.
Watching public/modules/core/tests/serviceTests for changes.
Watching public/modules/core/tests/checkout.client.controller.test.js for changes.
Watching public/modules/core/tests/dashboard.client.controller.test.js for changes.
Watching public/modules/core/tests/device-config.client.controller.test.js for changes.
Watching public/modules/core/tests/header.client.controller.test.js for changes.
Watching public/modules/core/tests/home.client.controller.test.js for changes.
Watching public/modules/core/tests/projectpanel.client.controller.test.js for changes.
Watching public/modules/core/tests/serviceTests/project.storage.service.test.js for changes.
Watching public/modules/invitations/controllers/invitations.client.controller.js for changes.
Watching public/modules/invitations/invitations.client.module.js for changes.
Watching public/modules/invitations/config for changes.
Watching public/modules/invitations/controllers for changes.
Watching public/modules/invitations/tests/invitations.client.controller.test.js for changes.
Watching public/modules/orders/config/orders.client.routes.js for changes.
Watching public/modules/orders/controllers/orders.client.controller.js for changes.
Watching public/modules/projects/config/projects.client.routes.js for changes.
Watching public/modules/projects/controllers/projects.client.controller.js for changes.
Watching public/modules/projects/projects.client.module.js for changes.
Watching public/modules/projects/config for changes.
Watching public/modules/projects/controllers for changes.
Watching public/modules/projects/services for changes.
Watching public/modules/projects/tests for changes.
Watching public/modules/projects/views for changes.
Watching public/modules/projects/services/projects.client.service.js for changes.
Watching public/modules/projects/tests/projects.client.controller.test.js for changes.
Watching public/modules/readings/config/readings.client.routes.js for changes.
Watching public/modules/readings/controllers/readings.client.controller.js for changes.
Watching public/modules/readings/tests/readings.client.controller.test.js for changes.
Watching public/modules/users/config/users.client.config.js for changes.
Watching public/modules/users/config/users.client.routes.js for changes.
Watching public/modules/users/controllers/authentication.client.controller.js for changes.
Watching public/modules/users/controllers/invitation-signup.client.controller.js for changes.
Watching public/modules/users/controllers/password.client.controller.js for changes.
Watching public/modules/users/controllers/settings.client.controller.js for changes.
Watching public/modules/users/services/authentication.client.service.js for changes.
Watching public/modules/users/services/users.client.service.js for changes.
Watching public/modules/users/tests/authentication.client.controller.test.js for changes.
Watching public/modules/users/users.client.module.js for changes.
Watching public/modules/users/config for changes.
Watching public/modules/chart/css/chart.css for changes.
Watching public/modules/core/css/admin.css for changes.
Watching public/modules/core/css/checkout.css for changes.
Watching public/modules/core/css/core.css for changes.
Watching public/modules/core/css/dashboard.css for changes.
Watching public/modules/core/css/details.css for changes.
Watching public/modules/core/css/device-config.css for changes.
Watching public/modules/core/css/font-awesome.css for changes.
Watching public/modules/core/css/footer.css for changes.
Watching public/modules/core/css/header.css for changes.
Watching public/modules/core/css/home.css for changes.
Watching public/modules/core/css/icomoon.css for changes.
Watching public/modules/core/css/overrides.css for changes.
Watching public/modules/core/css/project-panel.css for changes.
Watching public/modules/users/css/users.css for changes.
This detailed output stops here and does nothing after that, no matter what I do in the browser.
( localhost: 3000), , , , . , / .
, ?
** node npm , , -