Last Updated: February 25, 2016
·
754
· fayp

Yoeman project only building in root directory

I just spent a fair amount of time trying to get to grips with why when I build a new yoeman project from inside a subfolder of my main directory it will always go to the root.

It seem like the cause of this issue is due to the Gruntfile.js. Yoeman will look for Gruntfile.js in the directory you are in and if it isn't present it will work its way up to the highest directory it can be found, which in my case was the root! It will then build your project in the same directory as the Gruntfile.js file.

Simple solution, create your directory:
mkdir newapp && cd newapp

copy over the file from your root directory:
sudo cp -v Gruntfile.js newapp

and then start:
yeoman init

I hope this helps