kokarn / atom-grunt-runner

Run Grunt tasks from Atom.
MIT License
31 stars 23 forks source link

Error loading gruntfile: MODULE_NOT_FOUND #10

Open manifestinteractive opened 10 years ago

manifestinteractive commented 10 years ago

I did not see this listed, but I have a a Gruntfile.js that runs fine in CLI but will not run with this package. I get the following error:

Error loading gruntfile: MODULE_NOT_FOUND

Below is the contents of the Gruntfile.js

// Load Current Environments Settings
var configuration = require('./config/environment');

/*global module:false*/
module.exports = function(grunt) {

    var company_banner = '' +
        '/*! Some Company\n' +
        ' * @author <%= pkg.author %>\n' +
        ' * @version <%= pkg.version %>\n' +
        ' * @license Unauthorized copying of this file, via any medium is strictly prohibited.\n' +
        ' * This file cannot be copied and/or distributed without express written consent from @author.\n' +
        ' * @builddate <%= grunt.template.today("yyyy/mm/dd") %>\n' +
        ' */\n'

    var pkg = grunt.file.readJSON('package.json');

    // Project configuration.
    grunt.initConfig({

        pkg: pkg,
        pixelworker: grunt.file.copy('app/assets/javascripts/lib/PixelWorker.js', 'views/webworker.js'),

        concat: {
            options: {
                banner: company_banner
            },
            guest: {
                src: [
                    'app/assets/javascripts/lib/alertify.js',
                    'app/assets/javascripts/guest/GuestSocket.js',
                    'app/assets/javascripts/guest/GuestUI.js',
                    'app/assets/javascripts/guest/Guest.js',
                    'app/assets/javascripts/guest/GuestHelpers.js',
                    'app/assets/javascripts/lib/animate.js'
                ],
                dest: 'public/javascripts/guest.js'
            },
            company: {
                src: [
                    'app/assets/javascripts/host/CompanySocket.js',
                    'app/assets/javascripts/host/CompanyUI.js',
                    'app/assets/javascripts/host/CompanySessionStore.js',
                    'app/assets/javascripts/host/CompanyRenderingEngine.js',
                    'app/assets/javascripts/host/Company.js',
                    'app/assets/javascripts/host/CompanyHelpers.js',
                    'app/assets/javascripts/host/CompanyLanguage.js',
                    'app/assets/javascripts/lib/CanvasDiff.js'
                ],
                dest: 'public/plugin.js'
            },
            lib: {
                src: [
                    'app/assets/javascripts/lib/alertify.js',
                    'node_modules/html2canvas/build/html2canvas.js',
                    'app/assets/javascripts/lib/reqwest.js',
                    'app/assets/javascripts/lib/jsimagediff.js',
                    'app/assets/javascripts/lib/animate.js'
                ],
                dest: 'public/javascripts/clicklibs.js'
            },
            proxy: {
                src: [
                    'app/assets/lib/iframeproxy.js',
                    'node_modules/html2canvas/build/html2canvas.js'
                ],
                dest: 'public/javascripts/iframeproxy.js'
            }
        },
        sass: {
            production: {
                options: {
                    style: 'compressed'
                },
                files: {
                    'public/stylesheets/blue.css'   : 'app/assets/stylesheets/blue.scss',
                    'public/stylesheets/green.css'  : 'app/assets/stylesheets/green.scss',
                    'public/stylesheets/purple.css' : 'app/assets/stylesheets/purple.scss'
                }
            },
            development: {
                options: {
                    style: 'expanded',
                    lineNumbers: true
                },
                files: {
                    'public/stylesheets/blue.css'   : 'app/assets/stylesheets/blue.scss',
                    'public/stylesheets/green.css'  : 'app/assets/stylesheets/green.scss',
                    'public/stylesheets/purple.css' : 'app/assets/stylesheets/purple.scss'
                }
            }
        },
        jshint: {
            options: {
                laxcomma: true,
                lastsemic: true,
                browser: true
            },
            beforeconcat: [
                'app/assets/javascripts/host/Company*.js',
                'app/assets/javascripts/guest/Guest*.js'
            ],
            afterconcat: [
                'public/plugin.js',
                'public/javascripts/guest.js'
            ]
        },
        uglify: {
            options: {
                banner: company_banner,
                mangle: false
            },
            build: {
                files: {
                    'public/plugin.js':'public/plugin.js',
                    'public/javascripts/iframeproxy.js':'public/javascripts/iframeproxy.js',
                    'public/javascripts/PixelWorker.js':'views/webworker.js',
                    'public/javascripts/clicklibs.js':'public/javascripts/clicklibs.js',
                    'public/javascripts/guest.js':'public/javascripts/guest.js'
                }
            }
        },
        regarde: {
            css: {
                files: [
                    'app/assets/stylesheets/*.scss',
                    'app/assets/stylesheets/**/*.scss'
                ],
                tasks: [
                    'sass'
                ],
                events: true
            }
        },
        concurrent: {
            development: [
                'build',
                'uglify',
                'sass:development',
                'initServer'
            ]
        },
        qettlhup: {
            host: {
                test: {
                    lang: 'rspec',
                    path: 'spec/host.rb'
                },
                json: 'spec/BrowsersHost.json'
            },
            guest: {
                test: {
                    lang: 'rspec',
                    path: 'spec/guest.rb'
                },
                json: 'spec/BrowsersGuest.json'
            }
        },
        template: {
            socket: {
                options: {
                    data: {
                        company_url: configuration.company.host,
                        company_proxy: configuration.company.proxy,
                        company_reverse_proxy: configuration.company.reverseProxy,
                        company_assets: configuration.company.assets,
                        company_version: (process.env.NODE_ENV == 'development') ? Date.now() : pkg.version
                    }
                },
                files: {
                    'public/plugin.js':'public/plugin.js'
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-regarde');
    grunt.loadNpmTasks('grunt-qettlhup');
    grunt.loadNpmTasks('grunt-concurrent');
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-template');

    grunt.registerTask('remote', [
        'build',
        'sass:development',
        'initServer',
        'template'
    ]);
    grunt.registerTask('development', [
        'build',
        'sass:development',
        'initServer',
        'template'
    ]);
    grunt.registerTask('staging', [
        'build',
        'sass:production',
        'uglify',
        'initServer',
        'template'
    ]);
    grunt.registerTask('production', [
        'build',
        'sass:production',
        'uglify',
        'initServer',
        'template'
    ]);
    grunt.registerTask('build', [
        'jshint:beforeconcat',
        'concat',
        'jshint:afterconcat',
        'template'
    ]);
    grunt.registerTask('initServer', 'Output for app.js to parse and launch server', function(){
        console.log('Ready');
    });
};
nickclaw commented 10 years ago

This typically means that grunt-runner can't require your Gruntfile. Make sure you're Gruntfile is in the project root, and that you have opened your project in Atom at it's root.

grunt-runner will look for it at atom.project.getPath() + "/gruntfile"

manifestinteractive commented 10 years ago

So is it a problem if the file is named "Gruntfile.js" ? I do have the project open in the root.

On May 12, 2014, at 1:06 PM, Nicholas Clawson notifications@github.com wrote:

This typically means that grunt-runner can't require your Gruntfile. Make sure you're Gruntfile is in the project root, and that you have opened your project in Atom at it's root.

grunt-runner will look for it at atom.project.getPath() + "/gruntfile"

— Reply to this email directly or view it on GitHub.

nickclaw commented 10 years ago

It's worth a shot. It don't think it should matter if you're using Unix because I don't believe Unix is case sensitive. But try and let me know.

nickclaw commented 10 years ago

@manifestinteractive Were you able to resolve it? What was wrong?

faddah commented 10 years ago

i am seeing this also, just in starting up Atom 0.96.0 on Mac OS X 10.9.3 Mavericks. if you bring up the Developer Tools pane (cmd-alt.-i), you'll see this after launching Atom 0.96.0, even with no gruntfiles in a project being brought up —

grunt-runner: MODULE_NOT_FOUND                          grunt-runner-view.coffee:48

can anything be done about this? i was about to file a new issue when i saw this issue thread was all ready here. please advise.

best,

— faddah wolf portland, oregon, u.s.a. github.com/faddah

LukeMauldin commented 10 years ago

I am experiencing this same problem when opening a project without a grunt file.

nickclaw commented 10 years ago

That's intended. Just a little console.warn.

faddah commented 10 years ago

@nickclaw ,

thank you for the response. it may be "intended," but it's confusing to see this warning message. maybe in future a way to check if a project is meant to have a grunt file and, if not, do not display the warning? my suggestion.

best,

— faddah wolf portland, oregon, u.s.a. https://github.com/faddah

ArneNx commented 10 years ago

grunt-runner

I think I have the same problem as reported above. Is there any solution yet?

joseym commented 10 years ago

I was getting this error and was able to fix it by assigning my global grunt-cli in the settings for grunt-runner: /usr/local/lib/node_modules/grunt-cli.

Hope this also helps other.

polikin commented 9 years ago

Same error for me. MODULE_NOT_FOUND

eseceve commented 9 years ago

I fixed this error using /usr/local/bin/ in Grunt Paths

Grunt Paths

PD: It doesn't works with open-last-project package. It must close and reopen the project.

bendkt commented 9 years ago

After trying different configurations a re-install of the package did it.

OctoD commented 9 years ago

This happens everytime I launch a new atom session. I fix by running the command: Incompatible Packages: Reload Atom and Recheck Packages.

cmerot commented 9 years ago

I had to rename Gruntfile.js to gruntfile.js for this to work, otherwise MODULE_NOT_FOUND

runxc1 commented 9 years ago

So it appears that there are many ways to get this. For me I can only open the folder that contains the gruntfile.js, If I open a folder further up the tree I get this error.

tdolsen commented 9 years ago

I have the same issue, but it's apparent (in my case) that it only happens when I load a new folder while grunt-runner already has been loaded.

I.e. running atom from cli in a folder with a Gruntfile will work, but opening a blank Atom first, then changing the folder (to one that also have a Gruntfile) will not work. Doing View -> Reload will fix the issue.

It seems grunt-runner needs to reinitialize each time a new folder/project is loaded.

ghost commented 9 years ago

Can confirm same step with @tdolsen to get this working. Ensuring a View -> Reload will make it work 100% of the time.

kokarn commented 8 years ago

I think this is related to #91 Can people try to updated to the latest published version and try again?

ghost commented 7 years ago

Thanks @eseceve Worked for me too!