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 --gruntfile some/path/Gruntfile.js cannot find local grunt since grunt-cli 1.0.0 #101

Closed
EtienneMiret opened this issue Mar 22, 2016 · 18 comments

Comments

@EtienneMiret
Copy link

Since the release of grunt-cli 1.0.0, the command grunt --gruntfile some/path/Gruntfile.js issues the following error message :

Fatal error: Unable to find local grunt.

If you're seeing this message, grunt hasn't been installed locally to
your project. For more information about installing and configuring grunt,
please see the Getting Started guide:

http://gruntjs.com/getting-started

Before that release, the same command would work fine.

I have my package.json and my node_modules inside the directory some/path, next to Gruntfile.js.

Using :

  • node 5.9.0
  • npm 3.7.3
  • grunt-cli 1.0.0
  • grunt 0.4.5
@vladikoff
Copy link
Member

Thanks for the report!

@vladikoff
Copy link
Member

What OS are you on?

I cannot reproduce this issue, i made a test repo: https://github.com/vladikoff/issue-grunt-cli-101

Running grunt --gruntfile some/Gruntfile.js gives me

Running "jshint:all" (jshint) task
ERROR: Can't find config file: .jshintrc

So it can find everything. Let me know!

@vladikoff
Copy link
Member

@shama thoughts?

@EtienneMiret
Copy link
Author

Hello @vladikoff.

I'm having the issue with Travis-ci (can't link to a build though, because it is private) and with the release of Ubuntu you get with docker's digitallyseamless/nodejs-bower-grunt:latest.

@vladikoff
Copy link
Member

@EtienneMiret the dockerfile does nothing special here: https://hub.docker.com/r/digitallyseamless/nodejs-bower-grunt/~/dockerfile/

Could you try my test repo above and see if it is the same setup as your private project?

@EtienneMiret
Copy link
Author

I can reproduce the issue with your test repo:

$ git clone https://github.com/vladikoff/issue-grunt-cli-101.git
$ docker pull digitallyseamless/nodejs-bower-grunt:latest
$ docker run -it -v /home/etienne/workspace/issue-grunt-cli-101:/data digitallyseamless/nodejs-bower-grunt:latest
# npm --prefix some install
# ls some/
Gruntfile.js  etc  node_modules  package.json
# grunt --gruntfile some/Gruntfile.js 
grunt-cli: The grunt command line interface (v1.0.0)

Fatal error: Unable to find local grunt.

If you're seeing this message, grunt hasn't been installed locally to
your project. For more information about installing and configuring grunt,
please see the Getting Started guide:

http://gruntjs.com/getting-started
# cd some
# grunt 
Running "jshint:all" (jshint) task
ERROR: Can't find config file: .jshintrc

@vladikoff
Copy link
Member

I can reproduce the issue with your test repo:

Not true, see the output it actually loads the jshint task. Running "jshint:all" (jshint) task. By the time it throws the Can't find config file: .jshintrc everything is loaded.

@vladikoff
Copy link
Member

Oh wait nevermind

@vladikoff
Copy link
Member

Okay I'm checking on my Ubuntu 14 now...

@EtienneMiret
Copy link
Author

Thanks. I reproduced it on Travis, if that's of any help to you : https://travis-ci.org/EtienneMiret/issue-grunt-cli-101/builds/117728404.

@vladikoff
Copy link
Member

@EtienneMiret Ok I think I have it reproducible on Ubuntu 14 locally. thanks for testing it out...

@vladikoff
Copy link
Member

Ok the issue is the nopt update

@vladikoff
Copy link
Member

New:
{ gruntfile: true,
  argv: 
   { remain: [ 'some/Gruntfile.js' ],
     cooked: [ '--gruntfile', 'some/Gruntfile.js' ],
     original: [ '--gruntfile', 'some/Gruntfile.js' ] } }

Old:
{ gruntfile: 'some/Gruntfile.js',
  argv: 
   { remain: [],
     cooked: [ '--gruntfile', 'some/Gruntfile.js' ],
     original: [ '--gruntfile', 'some/Gruntfile.js' ],
     toString: [Function] } }

@vladikoff
Copy link
Member

@EtienneMiret your build should be fixed now via: 190d90c

@EtienneMiret
Copy link
Author

Indeed, it is. Thanks a lot.

@shama
Copy link
Member

shama commented Mar 23, 2016

This behavior is expected with grunt@1.0.0. See the release notes regarding nopt: http://gruntjs.com/blog/2016-02-11-grunt-1.0.0-rc1-released#api-changes

The new syntax should be grunt --gruntfile=some/path/Gruntfile.js.

@EtienneMiret
Copy link
Author

Oh, OK. Sorry about that. I read CHANGELOG.md before submitting this issue, maybe you want to put a link to gruntjs.com there.

@shama
Copy link
Member

shama commented Mar 23, 2016

@EtienneMiret That is a good idea. We've got this specific change now listed in the changelog and will try to make this change more prominent in the upcoming release notes for grunt@1.0.0. Thanks!

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

No branches or pull requests

3 participants