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

Yeoman init creates files in my home directory not the current directory #635

Closed
adamzr opened this issue Oct 15, 2012 · 73 comments
Closed
Labels

Comments

@adamzr
Copy link

adamzr commented Oct 15, 2012

I ran these commands:
cd ~/myproject
yeoman init bbb

The app and test directories were placed in my home directory ~ and not in the current directory myproject.

@murali529
Copy link

It's even worse for me. I don't see the files created at all

this is the output i get

murali@mmallapu-mac ~/Documents/my-work/testYeoman=>yeoman
yeoman v0.9.0
Usage: yeoman [command] [task [task ...]]

Available commands supported by yeoman:

  init  Initialize and scaffold a new project using generator templates
 build  Build an optimized version of your app, ready to deploy
server  Launch a preview server which will begin watching for changes
  test  Run a Mocha test harness in a headless Phantom.js

install Install a package from the clientside package registry
uninstall Uninstall the package
update Update a package to the latest version
list List the packages currently installed
search Query the registry for matching package names
lookup Look up info on a particular package

Certain commands such as init also provide further help via a --help flag
murali@mmallapu-mac ~/Documents/my-work/testYeoman=>yeoman init
Running "init:yeoman" (init) task
This task will create one or more files in the current directory, based on the
environment and the answers to a few questions. Note that answering "?" to any
question will show question-specific help and answering "none" to most questions
will leave its value blank.

"yeoman" template notes:

    _   .--------------------------.
  _|o|_ |    Welcome to Yeoman,    |
   |_|  |   ladies and gentlemen!  |
 / \Y/ \ o_________________________|
||  :  |//                          
o/ --- \                            
  _\ /_                             

Out of the box I include HTML5 Boilerplate, jQuery and Modernizr.

.. Invoke app ..

Please answer the following:
[?] Would you like to include Twitter Bootstrap for Compass? (Y/n)
[?] Would you like to include the Twitter Bootstrap plugins? (Y/n)
[?] Would you like to include RequireJS (for AMD support)? (Y/n)
[?] Would you like to support writing ECMAScript 6 modules? (Y/n)
[?] Do you need to make any changes to the above before continuing? (y/N)

Writing Gruntfile.js...OK
Writing package.json...OK
Reading /usr/local/lib/node_modules/yeoman/node_modules/yeoman-generators/lib/generators/yeoman/app/templates/gitignore...OK
Writing .gitignore...OK
Reading /usr/local/lib/node_modules/yeoman/node_modules/yeoman-generators/lib/generators/yeoman/app/templates/gitattributes...OK
Writing .gitattributes...OK
Reading /usr/local/lib/node_modules/yeoman/node_modules/yeoman-generators/lib/generators/yeoman/app/templates/jshintrc...OK
Writing .jshintrc...OK
Reading /usr/local/lib/node_modules/yeoman/node_modules/yeoman-generators/lib/generators/yeoman/app/templates/editorconfig...OK
Writing .editorconfig...OK
Reading /usr/local/lib/node_modules/yeoman/node_modules/yeoman-generators/lib/generators/yeoman/app/templates/favicon.ico...OK
Writing app/favicon.ico...OK
Writing app/styles/main.css...OK

Fetching http://nodeload.github.com/h5bp/html5-boilerplate/tarball/456211dc54c7a0328485d73cf25443d210d8e1d8
This might take a few moment
..........OK

Done in 0.926s.

Done in /Users/murali/.yeoman/cache/h5bp/html5-boilerplate/456211dc54c7a0328485d73cf25443d210d8e1d8

Reading /Users/murali/.yeoman/cache/h5bp/html5-boilerplate/456211dc54c7a0328485d73cf25443d210d8e1d8/.htaccess...OK
Writing app/.htaccess...OK
Reading /Users/murali/.yeoman/cache/h5bp/html5-boilerplate/456211dc54c7a0328485d73cf25443d210d8e1d8/404.html...OK
Writing app/404.html...OK
Reading /Users/murali/.yeoman/cache/h5bp/html5-boilerplate/456211dc54c7a0328485d73cf25443d210d8e1d8/index.html...OK
Writing app/index.html...OK
Reading /Users/murali/.yeoman/cache/h5bp/html5-boilerplate/456211dc54c7a0328485d73cf25443d210d8e1d8/robots.txt...OK
Writing app/robots.txt...OK
Reading /Users/murali/.yeoman/cache/h5bp/html5-boilerplate/456211dc54c7a0328485d73cf25443d210d8e1d8/js/vendor/jquery-1.8.0.min.js...OK
Writing app/scripts/vendor/jquery.min.js...OK
Reading /Users/murali/.yeoman/cache/h5bp/html5-boilerplate/456211dc54c7a0328485d73cf25443d210d8e1d8/js/vendor/modernizr-2.6.1.min.js...OK
Writing app/scripts/vendor/modernizr.min.js...OK

Fetching http://nodeload.github.com/twitter/bootstrap/tarball/v2.1.0
This might take a few moment
......................................................OK

Done in 1.347s.

Done in /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0

Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-affix.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-affix.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-alert.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-alert.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-button.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-button.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-carousel.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-carousel.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-collapse.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-collapse.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-dropdown.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-dropdown.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-modal.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-modal.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-popover.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-popover.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-scrollspy.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-scrollspy.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-tab.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-tab.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-tooltip.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-tooltip.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-transition.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-transition.js...OK
Reading /Users/murali/.yeoman/cache/twitter/bootstrap/v2.1.0/js/bootstrap-typeahead.js...OK
Writing app/scripts/vendor/bootstrap/bootstrap-typeahead.js...OK
Writing app/styles/main.scss...OK

Fetching http://nodeload.github.com/kristianmandrup/compass-twitter-bootstrap/tarball/19626592c8a2eafa8f52ee0344ef1ac30f74502f
This might take a few moment
...............OK

Done in 0.634s.

Done in /Users/murali/.yeoman/cache/kristianmandrup/compass-twitter-bootstrap/19626592c8a2eafa8f52ee0344ef1ac30f74502f

Writing app/styles/_compass_twitter_bootstrap.scss...OK
Writing app/styles/_compass_twitter_bootstrap_awesome.scss...OK
Writing app/styles/_compass_twitter_bootstrap_responsive.scss...OK
Writing app/styles/compass_twitter_bootstrap/_accordion.scss...OK
Writing app/styles/compass_twitter_bootstrap/_alerts.scss...OK
Writing app/styles/compass_twitter_bootstrap/_breadcrumbs.scss...OK
Writing app/styles/compass_twitter_bootstrap/_button-groups.scss...OK
Writing app/styles/compass_twitter_bootstrap/_buttons.scss...OK
Writing app/styles/compass_twitter_bootstrap/_carousel.scss...OK
Writing app/styles/compass_twitter_bootstrap/_close.scss...OK
Writing app/styles/compass_twitter_bootstrap/_code.scss...OK
Writing app/styles/compass_twitter_bootstrap/_component-animations.scss...OK
Writing app/styles/compass_twitter_bootstrap/_dropdowns.scss...OK
Writing app/styles/compass_twitter_bootstrap/_font-awesome.scss...OK
Writing app/styles/compass_twitter_bootstrap/_forms.scss...OK
Writing app/styles/compass_twitter_bootstrap/_grid.scss...OK
Writing app/styles/compass_twitter_bootstrap/_hero-unit.scss...OK
Writing app/styles/compass_twitter_bootstrap/_labels-badges.scss...OK
Writing app/styles/compass_twitter_bootstrap/_layouts.scss...OK
Writing app/styles/compass_twitter_bootstrap/_mixins.scss...OK
Writing app/styles/compass_twitter_bootstrap/_modals.scss...OK
Writing app/styles/compass_twitter_bootstrap/_navbar.scss...OK
Writing app/styles/compass_twitter_bootstrap/_navs.scss...OK
Writing app/styles/compass_twitter_bootstrap/_pager.scss...OK
Writing app/styles/compass_twitter_bootstrap/_pagination.scss...OK
Writing app/styles/compass_twitter_bootstrap/_popovers.scss...OK
Writing app/styles/compass_twitter_bootstrap/_progress-bars.scss...OK
Writing app/styles/compass_twitter_bootstrap/_reset.scss...OK
Writing app/styles/compass_twitter_bootstrap/_responsive-1200px-min.scss...OK
Writing app/styles/compass_twitter_bootstrap/_responsive-767px-max.scss...OK
Writing app/styles/compass_twitter_bootstrap/_responsive-768px-979px.scss...OK
Writing app/styles/compass_twitter_bootstrap/_responsive-navbar.scss...OK
Writing app/styles/compass_twitter_bootstrap/_responsive-utilities.scss...OK
Writing app/styles/compass_twitter_bootstrap/_responsive.scss...OK
Writing app/styles/compass_twitter_bootstrap/_scaffolding.scss...OK
Writing app/styles/compass_twitter_bootstrap/_sprites.scss...OK
Writing app/styles/compass_twitter_bootstrap/_tables.scss...OK
Writing app/styles/compass_twitter_bootstrap/_thumbnails.scss...OK
Writing app/styles/compass_twitter_bootstrap/_tooltip.scss...OK
Writing app/styles/compass_twitter_bootstrap/_type.scss...OK
Writing app/styles/compass_twitter_bootstrap/_utilities.scss...OK
Writing app/styles/compass_twitter_bootstrap/_variables.scss...OK
Writing app/styles/compass_twitter_bootstrap/_wells.scss...OK

Fetching http://nodeload.github.com/jrburke/requirejs/tarball/2.0.5
This might take a few moment
..................................................................................OK

Done in 1.705s.

Done in /Users/murali/.yeoman/cache/jrburke/requirejs/2.0.5

Reading /Users/murali/.yeoman/cache/jrburke/requirejs/2.0.5/require.js...OK
Writing app/scripts/vendor/require.js...OK
Writing app/index.html...OK
Writing app/scripts/app.js...OK
Writing app/scripts/main.js...OK

Fetching http://nodeload.github.com/jrburke/require-hm/tarball/0.2.1
This might take a few moment
....................OK

Done in 0.959s.

Done in /Users/murali/.yeoman/cache/jrburke/require-hm/0.2.1

Reading /Users/murali/.yeoman/cache/jrburke/require-hm/0.2.1/hm.js...OK
Writing app/scripts/vendor/hm.js...OK
Reading /Users/murali/.yeoman/cache/jrburke/require-hm/0.2.1/esprima.js...OK
Writing app/scripts/vendor/esprima.js...OK
Writing app/scripts/main.js...OK

.. Invoke mocha:app ..
Writing test/index.html...OK
Writing test/lib/chai.js...OK
Writing test/lib/expect.js...OK
Writing test/lib/mocha/mocha.css...OK
Writing test/lib/mocha/mocha.js...OK
Writing test/runner/mocha.js...OK

@sindresorhus
Copy link
Member

That's strange. I noticed your not running the latest yeoman version. Can you try upgrading and try again?

npm update -g yeoman

@zaver
Copy link

zaver commented Oct 17, 2012

Yep I am getting the same behaviour and updating yeoman didn't solve anything (actually did fresh install yesterday)

@craigmgordon
Copy link

I'm also seeing the same behaviour as the original poster. I.e. a new install of yeoman (two days ago) and regardless of which directory I am in, when i run "yeoman init" the app folder is created in my home directory. I've tried uninstalling and reinstalling yeoman and see the same behaviour. This is using Mountain lion on Mac for what its worth. I'm desperate to get this resolved!!

@adamzr
Copy link
Author

adamzr commented Oct 18, 2012

I'm on Mac OS X Lion, if that matters

@craigmgordon
Copy link

Anybody found a resolution for this yet? (Init always creating app folder in home directory)

@thorium0232
Copy link

I just did a fresh install. Mac OSX Mountain Lion and I have the same issue.

@sleeper
Copy link
Contributor

sleeper commented Oct 22, 2012

Could you please check if you do have a Gruntfile.js or gruntfile.js in your home directory ?

@thorium0232
Copy link

Yup. I have a Gruntfile.js in my home directory.

@sleeper
Copy link
Contributor

sleeper commented Oct 22, 2012

Ok. This is the root of all evil ;)

Basically, when a new yeoman project is created, and when it tries to setup the generators, it looks for a Gruntfile.js from the current working directory (i.e. the directory you just cd in), and then upward until it finds a Gruntfile.js.

If a Gruntfile.js is found, it will use the directory where it lies as the project 'root' directory. If it does not find one Gruntfile.js it will use your current working dir as the project directory.

@sindresorhus In case of the first yeoman init, can't we limit the path 'escalation' to the current working dir ?

@thorium0232
Copy link

Thanks! That fixed my problem.

@craigmgordon
Copy link

Excellent will try this tonight

@sindresorhus
Copy link
Member

@sleeper Ya, but what if you're in a subfolder? The yeoman command should work there too.

@sleeper
Copy link
Contributor

sleeper commented Nov 5, 2012

Right ... Is there any way to be "clever" ? Like having some clues that the found Gruntfile is really the one of the current project, and not one found up the tree ? Or make it explicit which Gruntfile is found and used ?

@sindresorhus
Copy link
Member

We could check that the folder also has a package.json file. But that too is fragile. I wonder if this would solve it self though, with the new proposed changes.

@Vanss472
Copy link

Vanss472 commented Dec 5, 2012

I have this same problem and the way I got it to work was:
$ mkdir project_name
$ cd project_name
then do $ yeoman init
and yeoman will create the project there in that directory. 👍

@mrosseel
Copy link

also got bitten by this, hope this gets resolved by changing output, behaviour or adding it to the FAQ

@sindresorhus
Copy link
Member

No longer relevant.

@clickblipclick
Copy link

This issue seems to have started happening to me. I have the latest Yeoman, and running yo backbone generates all of the files in my home directory, not the current directory.

Everything seems to run correctly, but the files all show up in the wrong place. I'm not sure what I did that caused it - I did reinstall node and npm, but not sure how that would cause this issue. It seems to happen with any generator.

@SBoudrias
Copy link
Member

Open an issue on the backbone generator you use. They may have introduced a bug.

@clickblipclick
Copy link

Well it's actually happening with any generator for me... I'm thinking it's not a bug but something I've messed up somehow but I'm not sure what it could be.

@SBoudrias
Copy link
Member

What is the OS you use?

@mrosseel
Copy link

former victim here, maybe you've already done this but make absolutely sure there is no Gruntfile.js in parent directories, home directory, current directory, ...

@clickblipclick
Copy link

I'm on OS X 10.9, and I've checked for an errant Gruntfile.js, no luck there either.

@SBoudrias
Copy link
Member

Is there a .yo-rc.json file in a parent directory?

@clickblipclick
Copy link

Yes! Thank you, removing that from my home directory solved it.

@achadha235
Copy link

Removing .yo-rc.json did it! Thank you

@cheesepencil
Copy link

Same issue on linux, removing .yo-rc.json fixed it. How does that situation happen?

@SBoudrias
Copy link
Member

@nagendertank Nothing else would cause this issue. You still have a .yo-rc.json file in a parent directory. You can google how to display hidden files.

@nagendertank
Copy link

@SBoudrias Hidden files are displaying and searched again for .yo.rc.json file and it is not showing anywhere in my system. still problem exists.

@SBoudrias
Copy link
Member

@nagendertank You can use findup. Then just type from your project folder: findup .yo-rc.json

It doesn't need to be in your home folder, it could be in any parent folder.

Also, yeoman warns you when it decides to run outside of the current directory. Read your log and you'll see where that file is.

@nagendertank
Copy link

@SBoudrias this is my log and Yo doctor is showing everything is fine but dont know why its creating all the files in home directory instead of project folder.

Nagendras-MacBook-Pro:DatePicker nagendratank$ yo doctor

Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version

Everything looks all right!
Nagendras-MacBook-Pro:DatePicker nagendratank$ findup .yo.rc.json
not found
Nagendras-MacBook-Pro:DatePicker nagendratank$

@SBoudrias
Copy link
Member

It's .yo-rc.json, not .yo.rc.json

@nagendertank
Copy link

@SBoudrias Thanks a lot!!!! finally its working.

@magicfaker
Copy link

Why I run gulp build needs to be modified after the inside of the dist picture path removed. The. / can be displayed

@magicfaker
Copy link

为什么我运行gulp build之后需要修改dist里面的图片路径删除../才可以显示出来

@GuyHarwood
Copy link

+1 on removing .yo-rc.json
worked for me

@ldexterldesign
Copy link

+1

Good few hours wasted diagnosing this

A more obvious mention on http://yeoman.io/ (i.e. http://yeoman.io/authoring/ > http://yeoman.io/authoring/user-interactions.html ) would be useful!

Thanks

@SBoudrias
Copy link
Member

PR is welcomed if you feel the documentation is missing.

FWIW, yeoman will print a warning on your console when this is happening. Also, as always, yo doctor will detect this issue - and many other you could run into.

@gregoryderner
Copy link

+1 on removing .yo-rc.json
worked for me

(Vagrant, Virtualbox, Ubuntu_Trusty-64)

Thanks
@SBoudrias

@careerscale
Copy link

Its even applicable now and removing the .yo-rc.json helped.

Thanks
Hari

@jbeckton
Copy link

jbeckton commented Feb 1, 2016

why does .yo-rc.json have to be a hidden file?

@chaosyuan
Copy link

@sterlingw thank you very much. removing the .yo-rc file

@jaspersorrio
Copy link

@SBoudrias good job on spotting the .yo-rc.json on parent folders!

Doing rm .yo-rc.json on folder that files are always created helped!!

So if yo something on yourPATHfolder/app/ created files at yourPATHfolder/,
cd yourPATHfolder/ and rm .yo-rc.json

@bownie
Copy link

bownie commented Jun 24, 2016

Would suggest the workflow for this 'feature' is changed. It just got me too. This is annoying and wrong.

@jadeye
Copy link

jadeye commented Sep 11, 2016

@koaning removing .yo-rc.json did it for me! Thanx

@bretonio
Copy link

Removing Gruntfile.js did not work for me. Removing both it and .yo-rc.json did! High drama. IOU beer.

@TangMonk
Copy link

TangMonk commented Jan 9, 2017

same problem

@Gardezi1
Copy link

@TangMonk try this solution this might help : yeoman/yo#204

@TangMonk
Copy link

@Gardezi1 thanks, I am using yo doctor to fixed

@Gardezi1
Copy link

@TangMonk awesome

@prakashshaurya
Copy link

Search for .yo-rc.json by ctrl+h and delete it. change the directory to project directory and generate project , worked for me.

@khosiDigital
Copy link

.yo-rc was in the parent directory....solved it!

@sadafnakhtare
Copy link

Copy the .yo-rc in the folder you want to create project. It solved my problem

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

No branches or pull requests