# Issue with theme directory npm installation

**URL:** https://discourse.roots.io/t/issue-with-theme-directory-npm-installation/2882
**Category:** sage
**Created:** 2015-02-11T00:12:46Z
**Posts:** 10

## Post 1 by @dvclmn — 2015-02-11T00:12:46Z

My issue arose when running `npm install` in my theme directory. I had already successfully installed gulp and bower globally as per the [Requirements](https://github.com/roots/roots/tree/8.0.0#requirements) on the Sage GitHub page:

> Requirements

- PHP \>= 5.4
- Node.js \>= 0.10
- npm \>= 2.1.5
- gulp (`npm install -g gulp`)  
Bower (`npm install -g bower`)

My limited experience with npm (and the CLI in general, tbh – I am making a big effort to learn) means unfortunately I can’t make any comment on the errors thrown, but [here](https://www.dropbox.com/s/togo4c1cg8571ky/npm-debug.log?dl=0) is the link to my `npm-debug.log` file; hopefully that will help.

If there is any more information I can provide, I’m happy to do so.

Thanks in advance for the help, and for such a great resource.

Dave.

---

## Post 2 by @ben — 2015-02-11T00:53:12Z

Your debug log link isn’t working for me, could you make a [gist](https://gist.github.com/) out of it?

---

## Post 3 by @dvclmn — 2015-02-11T11:07:27Z

Sure thing, here it is: [https://gist.github.com/anonymous/d4e2f2b9780e79a129b2#file-npm-debug-log](https://gist.github.com/anonymous/d4e2f2b9780e79a129b2#file-npm-debug-log)

---

## Post 4 by @ewafford — 2015-02-11T15:33:31Z

> 135727 error node v0.12.0  
> 135728 error npm v2.5.0

Just a shot, but [I have had issues with newer versions of npm/node](https://discourse.roots.io/t/npm-issues-with-gulp-branch/2848/3). Rolling back to the versions in my thread was the only thing that seemed to help me.

---

## Post 5 by @dvclmn — 2015-02-11T16:28:04Z

@ewafford Thanks for the advice, Eric.

Ha I’ll have a wrestle with nvm, it’s a little above my CLI-wielding levels, but I’ll see how I go rolling back. Enjoying the learning journey.

If you have a suggestion of a way to roll back that’s easier for a beginner than nvm, feel free to pop up a link, but no worries if not.

---

## Post 6 by @ewafford — 2015-02-11T16:48:05Z

No worries, gotta start somewhere, and I’m only a few CLI levels above you so don’t sweat it.

I assume you are running on mac/linux (mac for me) - I simply followed the instructions here: [https://github.com/creationix/nvm](https://github.com/creationix/nvm)

Then used the `nvm install` command to install the version of node I mentioned in the other thread. You will also want to use `nvm alias` to setup a default for use when opening up a shell.

HTH

---

## Post 7 by @dvclmn — 2015-02-11T17:51:04Z

@ewafford Much appreciated, I’ll give it a go.

@ben In the meantime, let me know if that debug log was helpful at all.

---

## Post 8 by @ben — 2015-02-11T22:11:56Z

If you don’t get running with nvm, can you try `npm install -g npm@latest` and then run `npm install` again?

---

## Post 9 by @dvclmn — 2015-02-12T12:23:37Z

**UPDATE:** I got all the packages installed for 7.0.3 (`npm install`). I used `sudo chown -R $(whoami) ~/.npm` to reclaim ownership of the .npm directory (I was constantly using `sudo`, I’m not sure if that was the cause of any of my troubles). I also brought node up to the latest stable version via nvm after having rolled back to an earlier version whilst troubleshooting 8.0.0, and finally reinstalled `grunt-cli` globally, just to make sure.

Really appreciate all your help, @ewafford @benword, thanks guys.

_Original post:_

Thanks @benword – I gave that a try, though no success.

I’ve decided to use 7.0.3 for now, as I figure my inexperience with packages like gulp, node etc is getting in the way. I was able to get 7.0.3 up and running before with little to no trouble – although now I’m having similar difficulty with installing npm (where I didn’t have any before trying 8.0.0).

Here’s some Terminal output which may be helpful, as well as my most recent log file:

```
bootstrap#3.3.1 assets/vendor/bootstrap
└── jquery#1.11.1
sh: grunt: command not found

npm ERR! Darwin 14.0.0
npm ERR! argv "/usr/local/lib/node_modules/nvm/versions/node/v0.12.0/bin/node" "/usr/local/lib/node_modules/nvm/versions/node/v0.12.0/bin/npm" "install"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! code ELIFECYCLE
npm ERR! roots@7.0.3 postinstall: `node node_modules/bower/bin/bower install && grunt dev`
npm ERR! Exit status 127
npm ERR! 
npm ERR! Failed at the roots@7.0.3 postinstall script 'node node_modules/bower/bin/bower install && grunt dev'.
npm ERR! This is most likely a problem with the roots package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node node_modules/bower/bin/bower install && grunt dev
npm ERR! You can get their info via:
npm ERR! npm owner ls roots
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/Dave/Dropbox/__theagsc/_localsites/theagsc/wp-content/themes/theagsc/npm-debug.log
```

Debug log file: [https://gist.github.com/anonymous/4d9b7e861d07491ec92b](https://gist.github.com/anonymous/4d9b7e861d07491ec92b)

Also should I move this to another Category, as I’m now using 7.0.3?

---

## Post 10 by @ericgauvin — 2015-09-08T02:21:45Z

> [@dvclmn](#):
>
> sudo chown -R $(whoami) ~/.npm

Thanks. This worked for me too.
