{"action":"created","issue":{"url":"https://api.github.com/repos/gruntjs/grunt-cli/issues/10","labels_url":"https://api.github.com/repos/gruntjs/grunt-cli/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/gruntjs/grunt-cli/issues/10/comments","events_url":"https://api.github.com/repos/gruntjs/grunt-cli/issues/10/events","html_url":"https://github.com/gruntjs/grunt-cli/issues/10","id":10802949,"number":10,"title":"Installing both grunt-cli and grunt globally","user":{"login":"wesleytodd","id":1027776,"avatar_url":"https://avatars.githubusercontent.com/u/1027776?v=3","gravatar_id":"","url":"https://api.github.com/users/wesleytodd","html_url":"https://github.com/wesleytodd","followers_url":"https://api.github.com/users/wesleytodd/followers","following_url":"https://api.github.com/users/wesleytodd/following{/other_user}","gists_url":"https://api.github.com/users/wesleytodd/gists{/gist_id}","starred_url":"https://api.github.com/users/wesleytodd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wesleytodd/subscriptions","organizations_url":"https://api.github.com/users/wesleytodd/orgs","repos_url":"https://api.github.com/users/wesleytodd/repos","events_url":"https://api.github.com/users/wesleytodd/events{/privacy}","received_events_url":"https://api.github.com/users/wesleytodd/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":39,"created_at":"2013-02-09T00:36:34Z","updated_at":"2015-08-19T19:02:22Z","closed_at":"2013-02-09T01:07:54Z","body":"I ran into an issue while trying to get grunt v0.4.0rc7 working globally.  I understand that best practice is to include grunt locally to a project, and normally do.  But in this particular situation it makes more sense to install it globally.\r\n\r\nThe steps I have taken so far are as follows:\r\n\r\n    sudo npm install -g grunt-cli\r\n    sudo npm install -g grunt@0.4.0rc7\r\n\r\nI have a `Gruntfile.js` in my project root with a basic `test` task that just prints \"Works!\".  When I run `grunt test` it fails saying `Fatal error: Unable to find local grunt.`.  I took a look at `node/bin/grunt` and logged the variable `gruntpath` inside the exit callback and it is an empty string.  Also the exit code is 11, not 0.  But if I replace all the logic for loading the cli module like:\r\n\r\n```javascript\r\nrequire(require.resolve(\"grunt\")).cli();\r\n```\r\n\r\nEverything works fine.\r\n\r\nSo am I missing something?  Is this just a fancy way of enforcing best practices and making people include grunt locally to a project?"},"comment":{"url":"https://api.github.com/repos/gruntjs/grunt-cli/issues/comments/132743729","html_url":"https://github.com/gruntjs/grunt-cli/issues/10#issuecomment-132743729","issue_url":"https://api.github.com/repos/gruntjs/grunt-cli/issues/10","id":132743729,"user":{"login":"shawnholt","id":2068714,"avatar_url":"https://avatars.githubusercontent.com/u/2068714?v=3","gravatar_id":"","url":"https://api.github.com/users/shawnholt","html_url":"https://github.com/shawnholt","followers_url":"https://api.github.com/users/shawnholt/followers","following_url":"https://api.github.com/users/shawnholt/following{/other_user}","gists_url":"https://api.github.com/users/shawnholt/gists{/gist_id}","starred_url":"https://api.github.com/users/shawnholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawnholt/subscriptions","organizations_url":"https://api.github.com/users/shawnholt/orgs","repos_url":"https://api.github.com/users/shawnholt/repos","events_url":"https://api.github.com/users/shawnholt/events{/privacy}","received_events_url":"https://api.github.com/users/shawnholt/received_events","type":"User","site_admin":false},"created_at":"2015-08-19T19:02:22Z","updated_at":"2015-08-19T19:02:22Z","body":"Wow - gulp npm install global vs. local is making this newbie bull his hair out!"}}