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

Gruntfile not found when dragging project folder into open window #25

Open
cperryk opened this issue Jan 9, 2015 · 3 comments
Open

Comments

@cperryk
Copy link

cperryk commented Jan 9, 2015

I can only get this package to work if I open my project by cd-ing into the project directory and running the "atom" command. If I instead open a new Atom window and drag my project directory into it, I will get a "fatal error: unable to find local grunt" upon attempting to run a grunt command.

@dwelle
Copy link
Contributor

dwelle commented Jan 10, 2015

6.1 should solve this, but it's not yet up on apm (#26) so you have to update manually (download zip and replace in your packages folder)

Edit:

I take it back, it's still not solved.

It seems the atom.project.getPath() resolves to undefined upon plugins initialization (see source), for some reason, so it might be an Atom issue. Not sure if that is the prime reason, though, because it's undefined even when Atom is started via console - but the plugin correctly recognizes project's path.

Also, it's not an issue of Gruntfile.js not being found, it's the issue of Gruntfile.js being search for in a different folder - in this case in your Atom.exe folder (to which it falls back).

In any case, this is a duplicate of your prev issue #20

@cperryk
Copy link
Author

cperryk commented Jan 14, 2015

I don't know much about developing these Atom plugins, but here's my theory after fiddling with the code for a few minutes: The plugin's initialization function, which caches the project path, runs when a new window is opened. If the user clicks on a file in the project directory or runs the "atom" command there, a window opens and the path is defined immediately. But when the user opens a blank new window, the path is not defined (how could it be? nothing is open). When the user drags a folder into the window or opens a project via the Project Manager extension, the project path is then defined, but Grunt Runner doesn't know this because it's not listening for the change.

So, basically, to get around this, Grunt Runner either needs to listen for changes to the project path or wait until the user attempts to use Grunt Runner to use the path (because it would be available then). For the latter approach, is it possible the package could just wait until the user tries to use the Run command to parse the gruntfile?

@ealves-pt
Copy link
Contributor

Duplicate of #10. Several issues cause Error loading Gruntfile: gruntfile not found

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

No branches or pull requests

3 participants