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

Atom Grunt Runner does not load properly when using 'grunt-contrib-requirejs' module #90

Open
Maloric opened this issue Feb 15, 2016 · 14 comments
Labels

Comments

@Maloric
Copy link

Maloric commented Feb 15, 2016

This may be a duplicate of #10 but as I have slightly different symptoms and the fix there didn't work for me, I thought I should post as a separate issue and let the community decide.

I'm using the following line to load my grunt modules:

require('load-grunt-tasks')(grunt);

My grunt tasks all run fine in PowerShell, but when trying to run via Atom, I get the following error:

image

Things I have tried that didn't work:

  • Updated all node modules
  • Loaded the folder via project manager
  • Loaded the folder via "Open Folder"
  • Loaded atom via the command line in the project folder
  • Renaming "Gruntfile.js" to "gruntfile.js" or removing the extension

However, the following steps work:

  1. Comment out the require('load-grunt-tasks')(grunt); line in Gruntfile.js
  2. Reload "grunt-runner" package in Atom by disabling and enabling it.
  3. Show the "grunt-runner" panel and check the log to confirm that the grunt file was parsed (for some reason it always shows the panel when the package is reenabled, but then hides it once the grunt file has finished parsing).
  4. Uncomment the load tasks from step 1.
  5. Run grunt tasks via grunt-runner without reloading the package.

image

Obviously this isn't an ideal solution, but hopefully will help someone else, either in fixing the issue or working around it for now.

@ealves-pt ealves-pt added the bug label Feb 15, 2016
@kokarn
Copy link
Owner

kokarn commented Feb 16, 2016

Can you try the latest version? It looks like in your first example there is an extra space, might be that #91 actually fixed this for you, even tho it seems unrelated.

@Maloric
Copy link
Author

Maloric commented Feb 16, 2016

I updated to 0.13.6 and the error has disappeared but I get no "Grunt file parsed" message, and no output when trying to run a task that runs fine in the console:

image

@kokarn
Copy link
Owner

kokarn commented Feb 16, 2016

So now it's not detecting the gruntfile at all. Interesting.
Could you try with a folder that's more plain? No spaces or dots etc

@Maloric
Copy link
Author

Maloric commented Feb 16, 2016

I copied the project to a new folder but I get the same result. I tried reloading the package just to be sure, but it doesn't work. Remember that I mentioned the panel closes itself normally when it works? i.e. When I enable the package, the panel shows up for a second, blank, and then disappears once the Grunt file is parsed. Well that doesn't happen here. The panel just shows up and never disappears:

image

@kokarn
Copy link
Owner

kokarn commented Feb 16, 2016

This is weird.
I'm guessing it has something to do with windows.
We've had some issues with path separators and stuff like that before.

Just to be sure, you can't run anything when the panel is there?

@Maloric
Copy link
Author

Maloric commented Feb 16, 2016

It doesn't appear so. I tried running a few different tasks. In the previous scenario where I load the package with the "load-grunt-tasks" line commented out, it works fine and I see the correct output. In this scenario, however, it does nothing at all, and the "Start Grunt" button never changes to "Stop", even for long running tasks.

@kokarn
Copy link
Owner

kokarn commented Feb 16, 2016

Ok yeah, it's really weird.
load-grunt-tasks REALLY shouldn't matter...
Any more information you can find out is helpful, maybe @ealves-pt has any thoughts?

@ealves-pt
Copy link
Contributor

At the moment I don't have any idea regarding this issue. I have going through the code testing several approaches and preparing a new feature that aims to solve this issues. I am also thinking about writing some tests to help us a bit more in the future.

@Maloric can you provide a Gist with a simple gruntfile that fails in your case? So I can test my code with it.

@Maloric
Copy link
Author

Maloric commented Feb 16, 2016

Will do. My first attempt at a stripped down project with one simple grunt task does work (even with 'load-grunt-tasks'), so I'll check back in once I get it to the point of failure (at which point it should hopefully be more obvious what is happening).

@ealves-pt
Copy link
Contributor

Thanks mate 👍

@Maloric
Copy link
Author

Maloric commented Feb 16, 2016

Ok, here it is. The culprit is actually grunt-contrib-requirejs, and it fails when loading normally (as well as via load-grunt-tasks). Just do an npm install on this gist and you should have the same problem as me.

https://gist.github.com/Maloric/e43096def392fc57701e

@Maloric Maloric changed the title Operation Not Permitted when using 'load-grunt-tasks' module Operation Not Permitted when using 'grunt-contrib-requirejs' module Feb 16, 2016
@Maloric Maloric changed the title Operation Not Permitted when using 'grunt-contrib-requirejs' module Atom Grunt Runner does not load properly when using 'grunt-contrib-requirejs' module Feb 16, 2016
@ealves-pt
Copy link
Contributor

Nice, thank you. I have also managed to replicate the issue in a project where I use grunt-contrib-requirejs. Now we might be able to debug it properly.

@kokarn
Copy link
Owner

kokarn commented Feb 16, 2016

Great! I've also been thinking about some tests so that's awesome that you are thinking the same.

@DSpeckhals
Copy link
Contributor

I actually ran into this same problem a while back on a WIndows machine. I think it has to do with the way that grunt-contrib-requirejs is loading requirejs within the forked Atom->node process. I opened an issue for it in grunt-contrib-requirejs. In that issue, you'll see a way to monkey patch one of the files. I think that it has something to do with r.js detecting the electron environment strangely.

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

4 participants