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

grunt exited with code 1 #63

Open
maxiz opened this issue Sep 5, 2015 · 11 comments
Open

grunt exited with code 1 #63

maxiz opened this issue Sep 5, 2015 · 11 comments
Labels

Comments

@maxiz
Copy link

maxiz commented Sep 5, 2015

I installed the runner (v 0.11.0) and the gruntfile gets parsed successfully. But running a task fails with an error message saying "Grunt exited with code 1."

@kokarn
Copy link
Owner

kokarn commented Sep 11, 2015

Sorry, forgot to answer.

Can you post your gruntfile so we can have a look at that?

@maxiz
Copy link
Author

maxiz commented Sep 12, 2015

Here's the gruntfile. Some file paths have been removed for simplicity.

module.exports = function (grunt) {
    'use strict';
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),      
        notify_hooks: {
            options: {
                enabled: true,
                max_jshint_notifications: 5,
                success: true, 
                duration: 3
            }
        },
        ts: {            
            options: {
                target: 'es5',
                module: 'amd',
                sourceMap: true,
                declaration: false,
                nolib: false,
                comments: false,
                compress: true,
                report: true,
            },
            dev: {
                files: [{ src: ['Scripts/**/*.ts', '!Scripts/**/*.d.ts'] }],
                expand: true,
                options: {
                    sourceMap: true,
                    title: 'Typescript',
                    message: 'Compilation completed'
                }
            }
        },
        sprite: {
            all: {
                algorithm: 'binary-tree',
                dest: 'Images/dest.png',
                destCss: 'Styles/dest.png.less',
                src: ['Images/*.png']
            },
            xref: {
                algorithm: 'binary-tree',
                dest: 'Images/dest.png',
                destCss: 'Styles/dest.png.less',
                cssFormat: 'less',
                src: [ /* Files removed */]
            }
        },
        less: {
            dev: {
                options: {
                    compress: true,
                    optimization: 2,
                    relativeUrls: true,
                },
                files: [{
                    expand: true,
                    cwd: 'Styles/',
                    src: ['**/*.less'],
                    ext: '.css',
                    dest: 'Styles/'
                }]
            }
        },
        cssmin: {
            allstyles: {
                options: {                    
                    noRebase: true
                },
                files: [{
                    expand: true,
                    cwd: 'Styles',
                    src: ['**/*.css', '!**/*.min.css'],
                    dest: 'Styles/',
                    ext: '.min.css'
                }]
            },
            bundle: {
                options: {
                    noRebase: true,
                },
                files: {
                    'Styles/bundles/commonbundle.min.css': 'Styles/bundles/commonbundle.css'
                }
            }
        },
        uglify: {
            options: {
                compress: false,
                mangle: true,
                sourceMap: true,
                report: true,
                unused: false
            },
            applib: {
                options: {
                    unused: false
                },
                files: [{
                    expand: true,
                    cwd: 'Scripts/',
                    src: ['**/*.js', '!**/*.min.js'],
                    dest: 'Scripts/',
                    ext: '.min.js'
                }]
            },
            combine: {
                options: {
                    unused: false
                },
                files: [{
                    expand: true,
                    cwd: 'Scripts/bundles',
                    src: ['*.js', '!*.min.js'],
                    dest: 'Scripts/bundles/',
                    ext: '.min.js'
                }]
            }
        },
        concat: {
            options: {
                title: 'Concat',
                message: 'Concatination completed'
            },
            styles: {
                files: {
                    'Styles/bundles/commonbundle.css': [/* File paths */]                    
                }
            },
            scripts: {
                options: {
                    separator: ';\n'
                },
                files: {
                    'Scripts/bundles/commonscripts.js': [/* File paths */]                    
                }
            }
        },        
        exec: {
            options: {
                title: 'Publish Completed',
                message: 'Published files successfully'
            },
            publish: {
                cmd: '"C:\\Program Files\\SyncToy 2.1\\SyncToyCmd.exe" -R dest',
                stdout: true,
                stderr: false,
                options: {
                    title: 'Publish Completed',
                    message: 'Published files successfully'
                }
            }            
        },
        watch: {
            scripts: {
                files: ['Scripts/**/*.ts', '!Scripts/**/*.d.ts'],
                tasks: ['ts', 'concat:scripts', 'exec:publish'],
                options: {
                    nospawn: true,
                }
            },
            styles: {
                files: ['Styles/**/*.less'],
                tasks: ['less', 'concat:styles', 'cssmin:bundle', 'exec:publish'],
                options: {
                    nospawn: true
                }
            },
            htmls: {
                files: ['**/*.aspx', '**/*.ascx', '**/*.master', '**/*.html'],
                tasks: ['exec:publish'],
                options: {
                    nospawn: true
                }
            },
            grunt: {
                files: ['Gruntfile.js']
            }
        },
    });

    require("load-grunt-tasks")(grunt, { pattern: ['grunt-*'] });    
    grunt.registerTask('default', ['watch']);
    grunt.registerTask('compileStyles', ['less', 'concat:styles', 'cssmin:bundle']);
    grunt.registerTask('compileScripts', ['ts:dev', 'concat:scripts']);
    grunt.registerTask('publish', ['ts:dev', 'less', 'concat', 'cssmin:bundle', 'exec:publish']);
    grunt.registerTask('publishScripts', ['ts:dev', 'concat:scripts', 'exec:publish']);
    grunt.registerTask('publishStyles', ['less', 'concat:styles', 'cssmin:bundle', 'exec:publish']);
    grunt.registerTask('prod', ['ts:dev', 'less', 'cssmin:allstyles', 'uglify:applib', 'concat', 'cssmin:bundle']);
    grunt.registerTask('createsprites', ['sprite:all']);
    grunt.registerTask("copyOnly", ['exec:publish']);

};

Thanks,

@kokarn
Copy link
Owner

kokarn commented Sep 23, 2015

Could you try with the latest version from master and see if that fixes the issue?

@maximegris
Copy link

Did you install "grunt-cli" package on nodejs ? => npm install -g grunt-cli
You need it to start the runner.

@maxiz
Copy link
Author

maxiz commented Sep 30, 2015

@maximegris - Yes, I had installed grunt-cli globally. The package worked with a simple gruntfile but was having trouble with the gruntfile I posted above.

@kokarn - Thanks for the update. I'll update the package and see if it works.

@kokarn
Copy link
Owner

kokarn commented Sep 30, 2015

We had some problems with mocha making grunt unable to run. Would you mind commenting out one task at a time to see if you can narrow it down?

@NKjoep
Copy link

NKjoep commented Oct 23, 2015

I have the same problem and I'd like to help. Do you need any log?
I'm running node 4 with windows 7 x64

@kokarn
Copy link
Owner

kokarn commented Feb 9, 2016

@maxiz @NKjoep Did you get this to work?

@NKjoep
Copy link

NKjoep commented Feb 9, 2016

@kokarn Honestly, I gave up and continued with my standard CLI.

should I try again? :)

@kokarn
Copy link
Owner

kokarn commented Feb 9, 2016

Sure! Any input is appreciated. Quite a few updates to the package since you had trouble with it.

@ealves-pt ealves-pt added the bug label Feb 10, 2016
@yhormanp
Copy link

This is what I did based on what I read on this post to solve the issue. Hope this works for anyone else.

I had the same issue with "Grunt exited with code 1.". But after read this post I uninstalled
-Grunt-runner
-build (atom-build)

through cmd installed ----- npm install -g grunt-cli
installed again Grunt-runner

and now it's working fine with any of the grunt file that I have in several projects.

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

No branches or pull requests

6 participants