Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9118193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:05:12+00:00 2026-06-17T05:05:12+00:00

So, I have the grunt file below. I’m wanting to add a task that

  • 0

So, I have the grunt file below. I’m wanting to add a task that will start my node app and watch for changes in a directory and restart. I have been using supervisor, node-dev (which are great) but I want to run one command and start my whole app. There has got to be a simple way to do this, but I’m just missing it. It is written in coffeescript as well (not sure if that changes things)…

module.exports = function(grunt) {
  grunt.initConfig({
    /*exec: {
        startApi: {
            command: "npm run-script start-api"
        }
    },*/
    //static server
    server: {
        port: 3333,
        base: './public',
        keepalive: true
    },

    // Coffee to JS compilation
    coffee: {
        compile: {
            files: {
                './public/js/*.js': './src/client/app/**/*.coffee'
            },
            options: {
                //basePath: 'app/scripts'
            }
        }
    },


    mochaTest: {
        all: ['test/**/*.*']
    },


    watch: {
        coffee: {
            files: './src/client/app/**/*.coffee',
            tasks: 'coffee'
        },
        mochaTest: {
            files: 'test/**/*.*',
            tasks: 'mochaTest'
        }
    }
});

grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-mocha-test');
//grunt.loadNpmTasks('grunt-exec');

grunt.registerTask( 'default', 'server coffee mochaTest watch' );
};

As you can see in the comments, I tries grunt-exec, but the node command stops the execution of the other tasks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:05:13+00:00Added an answer on June 17, 2026 at 5:05 am

    You can set grunt to run default task and the watch task when you start your node app:

    in app.js

    var cp = require('child_process');
    var grunt = cp.spawn('grunt', ['--force', 'default', 'watch'])
    
    grunt.stdout.on('data', function(data) {
        // relay output to console
        console.log("%s", data)
    });
    

    Then just run node app as normal!

    Credit

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an asp.net mvc app that has a form that uploads a file.
I have file writing permission denied problem in my web application, below is the
Let's say in my Gruntfile I have pkg: grunt.file.readJSON('package.json') , and inside the package.json
For a single page app that I'm working on, I have the following structure:
For example if I have an XML file (exported from another app, so I
I'm building a grunt javascript project with grunt, and I have a package.json file
I have some code in a grunt.js file which is working with 0.3 but
I have a web application that uses AzMan authorization to grant different functionality to
I have the next file: create_mysql.sql DROP DATABASE IF EXISTS playence_media; CREATE DATABASE playence_media;
I have this regex that allow all php files : ^.*\.([Pp][Hh][Pp]) how can I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.