# Grunt: install problems and confusion

**URL:** https://discourse.roots.io/t/grunt-install-problems-and-confusion/148
**Category:** sage
**Created:** 2013-08-23T21:22:40Z
**Posts:** 28

## Post 1 by @sticklechick — 2013-08-23T21:22:41Z

Hi there:

I’ve been using Roots for a while without Grunt–manually making changes to app.css and the .less files (compiling via CodeKit). But with the new build, it looks like I need to use Grunt and I’m stuck trying to get it installed.

I’m on a mac and installed node.js

Then in terminal typed:

```
sudo npm install -g grunt-cli
```

It ran a bunch of stuff and seemed to install fine. No errors.

The next instruction in Roots 101 is to “install the dependencies for Roots contained in package.json:”

So I in terminal I typed:

```
npm install
```

But got the following errors:

```
npm ERR! install Couldn't read dependencies
npm ERR! Error: ENOENT, open '/Users/xyz/package.json'
```

What am I missing here? And once installed, how do I invoke Grunt? Always from within terminal? I’m totally baffled. A down and dirty screencast of this might be helpful…

Thanks!  
Lauren

---

## Post 2 by @ben — 2013-08-23T21:46:55Z

Looks like you’re not running `npm install` from the theme root directory. After that’s done, you’ll run `grunt watch` from terminal (from your theme root directory) to have it watch changes and run the tasks.

Making a note now to update the site to mention the theme directory - sorry about that!

Screencast is coming!

edit: by ‘theme root’ I mean your roots directory (e.g. wp-content/themes/roots/)

---

## Post 3 by @Kutakizukari — 2013-08-24T02:05:09Z

How to install grunt on windows would be nice too.

---

## Post 4 by @Giles — 2013-08-24T19:21:10Z

Grunt has some tips on installing for Windows in their FAQ [http://gruntjs.com/frequently-asked-questions](http://gruntjs.com/frequently-asked-questions)  
It involves installing Git for Windows then node.js (which includes npm)  
Worked for me

---

## Post 5 by @Rafael — 2013-08-24T23:20:29Z

I’ve been aswell trying to configure grunt. I did install this dependencies:  
grunt-contrib-jshint, grunt-contrib-uglify, grunt-contrib-clean, grunt-contrib-watch and grunt-recess.

When I run `grunt` on my terminal I got the following errors:

```
>> Tasks directory "tasks" not found.
Warning: Task "version" not found. Use --force to continue.
```

Do I need to create a folder tasks ?? and is any dependency that manages version ??

---

## Post 6 by @theherounit — 2013-08-25T09:15:28Z

hi sticklechick,

not sure if you have found a solution yet but i had the same problem and managed to finally work it out. you have to get your terminal to run from the folder where the gruntfile.js are package.json are located.

type in:

```
cd
```

then either copy your roots folder path or just drag the folder into the terminal. after you run it your terminal name should change to your folder name.

then after that you run:

```
npm install
```

then:

```
grunt watch
```

anyway. this solution worked for me on my mac. maybe the `cd` command will be different on windows. not too sure.

---

## Post 7 by @howdous — 2013-08-25T09:28:35Z

This could help - [http://www.ghosthorses.co.uk/production-diary/installing-grunt-on-os-x-and-windows-7/](http://www.ghosthorses.co.uk/production-diary/installing-grunt-on-os-x-and-windows-7/)

---

## Post 8 by @imaginethepoet — 2013-08-26T16:31:29Z

Grunt is looking for a tasks directory in the same location as your project. You are most likely missing this directory there is a roots file in there called version.js that does various things with the enqueue of scripts…

---

## Post 9 by @shaimoom — 2013-08-26T22:37:35Z

This worked! Thanks.

---

## Post 10 by @shaimoom — 2013-08-26T22:38:29Z

For Windows, first install node.js. Then open up the Command Prompt to install Grunt.

---

## Post 11 by @Rafael — 2013-08-27T10:45:19Z

Yes, you are right . I was missing this directory. All sorted . Thanks

---

## Post 12 by @imaginethepoet — 2013-08-27T13:09:55Z

Awesome! I had that problem when I first started out a while ago as well:)

---

## Post 14 by @imaginethepoet — 2013-09-03T14:04:23Z

You probably do not have node installed globally - this would explain why you need to use the node command problem.

---

## Post 15 by @ShagenBake — 2013-09-03T19:43:04Z

I am thoroughly confused. Also, I am quite out of my element. I am new to node.js, grunt, git and not very great at command line. I want to learn and start using LESS in tandem with Roots. Typically I download a theme and install and then I am off and running. I am good with WP structure, templates, html, CSS, etc. I am a front end man. However I really want to learn these other elements as well.

That being said I am confused on where all this is happening. I am developing on a live server that is hosted by Host Monster. Do I need to install node, grunt, etc. on there via the command line. I have shell access and have found a few tutorials on the matter but find myself stuck. Am I over complicating and should I be doing this all locally. Any direction, documentation or better yet tutorials that could walk me through A-Z to get Roots up and running would be appreciated. I really have enjoyed Roots and look forward to the enhancements of this version once I get past these hurdles. Thanks for the time.

---

## Post 16 by @ben — 2013-09-03T21:43:39Z

I’m finishing up a screencast that will address all of these things and hope to have it up soon.

You don’t want to install node/grunt on your server - you need to setup a local development environment to work off of, and install node and grunt locally.

---

## Post 17 by @ShagenBake — 2013-09-04T11:15:50Z

Looking forward to the screencast! Thanks for putting in that time. So quickly to clarify. If I am developing on a live site and server I don’t have to go through this process and things will work so that I can use LESS on the fly. My goal is really to be able to learn and start utilizing LESS as I have not been tapping into the full power of Roots, Bootstrap and LESS. This is what compiles that code, correct? Something in my process may be broken and I am just trying to figure out what that is. Developing on a live site may where I am going wrong and to be honest it is more due to lack of knowledge to get that piece right.

Anyways I wanted to say thanks Ben for all your work as well as the contributors to the project. I have enjoyed using Roots immensely over the past year and we exclusively use it as a starting point for all our clients themes. Even not being a hard core programmer I am able to grasp and utilize it’s many features to really help me produce better custom themes.

---

## Post 18 by @ben — 2013-09-04T16:23:49Z

If you are developing on a live server **you need to not be doing that!** Stop right now and get a local development environment setup along with some sort of version control (we recommend git)

Are you on Mac or Windows?

---

## Post 19 by @ben — 2013-09-05T14:46:37Z

Screencast is now available:

[http://roots.io/screencasts/how-roots-uses-grunt/](http://roots.io/screencasts/how-roots-uses-grunt/)

---

## Post 20 by @ShagenBake — 2013-09-05T14:50:42Z

Ben, I am on Mac. I have been wanting to learn GIT for a while now and I will try and dive in based on your recommendation. Always have had a bit of a hard time with versioning when it comes to WP but I am positive that is more on my end than anyone else’s fault. Any recommendations in terms or documentation, tutorials, etc. that could help me get up to speed. Kind of dreading it but know that there is high value there. Thanks for pushing me that direction and giving me a bit of a slap on the wrist! Looking forward to working through the screen cast.

---

## Post 21 by @imaginethepoet — 2013-09-06T20:26:59Z

The easiest way to setup a dev environment locally on your mac is to use mamp. This will setup php, mysql and all the stuff you need to get a dev server up and running with a local wordpress install. Smashing has a good article on this.

> **[How To Develop WordPress Locally With MAMP — Smashing Magazine](https://www.smashingmagazine.com/2011/09/developing-wordpress-locally-with-mamp/)**
>
> Local development refers to the process of building a website or Web application from the comfort of a virtual server, and not needing to be connected to the Internet in order to run PHP and MySQL or even to test a contact form. One of the most...

I’m actually developing on both so I have mamp on my mac & xampp on my pc. You will want to tweak a few security settings if you use any of these packages. There is a slight learning curve. After you get this up and running it’s just a matter of setting up a new directory under htdocs/test - and then setting up your grunt and roots install from that directory. Then you can go into wordpress and apply the theme. Then develop super fast:)

Also go checkout the great screencast .

[http://roots.io/screencasts/how-roots-uses-grunt/](http://roots.io/screencasts/how-roots-uses-grunt/)

---

## Post 22 by @ShagenBake — 2013-09-09T22:23:55Z

Purchased and walked through the screencast today. Although much of it was over my head I was able to get a local development environment setup using MAMP. I have nodejs, grunt and live LiveReload running. It is great so far. I walked through a bit of a tutorial on git and starting reading up on how to set up git with Wordpress safely, etc. Still not close on the last part but I can start developing locally and connect with some guys a lot smarter than me to help me walk through using git. I love the idea of version control. I love the idea of local development. LiveReload is the business.

The only parts that I was semi lost in the screencast were…

- I did not realize that I should have roots ready and installed before doing some of the commands in the terminal. One of the things that I had to do before LiveReload would work is control ‘C’ out of the grunt watch and install the plugin and then watch again. That is when it started working for me there.

Anyway, wanted to say thank you and am looking forward to continuing my personal learning and getting a grasp on a lot of what I feel so behind on. I have great support within my company and usually don’t have to spend time on this stuff but teaching a man, in this case myself, to fish is a great thing.

Good work. Looking forward to learning LESS and checking out the what’s new in Roots!

---

## Post 23 by @jmjf — 2013-09-10T15:19:47Z

> [@imaginethepoet](#):
>
> The easiest way to setup a dev environment locally on your mac is to use mamp.

MAMP on Mac, XAMPP/WAMP on Windows.

But… I’ve found (after a lot of work) that when Ben says “Rewrites aren’t supported for multisite installations or if a child theme is activated.” in [Roots 101](http://roots.io/roots-101/) what he means is, “Rewrites don’t work if your WordPress install is in a folder beneath the server’s document root.”

That conclusion is based on a couple of days of testing and pulled hair with XAMPP on Windows and Apache on Ubuntu (duplicated same behavior both places with vanilla WP3.6 installs and copies of Roots master branch).

---

## Post 24 by @imaginethepoet — 2013-09-10T21:06:08Z

Yeah - I don’t do a lot of multi-site development, usually one offs. Thanks for the heads up.

---

## Post 25 by @sticklechick — 2013-10-01T00:10:18Z

Yes, changing the root directory was what I needed to do. Thanks!

---

## Post 26 by @sticklechick — 2013-10-01T00:12:20Z

Just wanted to say that I finally got around to watching the grunt screencast and it was so incredibly helpful. Thanks for putting it together, Ben. Great work!

---

## Post 27 by @Mujtaba_Mubareez — 2016-12-30T08:30:48Z

**Hi imaginethepoet** ,  
I think I have the same problem can you please guide me with more details.  
I really appreciate it.

---

## Post 28 by @ben — 2022-02-26T02:58:34Z


