yo angular generates files in wrong path ( home directory )
Asked Answered
N

6

16

yo angular generates the files in my home directory and I don't know why.

I did the following:

ppa for node

curl -sL https://deb.nodesource.com/setup | sudo bash -

then install node

sudo apt-get install -y nodejs

create a symlink

sudo ln -s "$(which nodejs)" /usr/bin/node

install yeoman

sudo npm install -g yo
sudo npm install -g generator-angular

next steps from the instruction from https://github.com/yeoman/generator-angular

mkdir my-new-project && cd $_

now I run

yo angular test1

now all the files will be created in my home directory instead of the my-new-project directory where I am currently. What did I wrong?

node -v: v0.10.36

npm -v: 2.5.1

Update1: new npm version

Solution:

yo angular looks for .yo-rc.json file in the current directory, if the file isnt there it tries to find it in the home dir. To solve this:

look for a hidden .yo-rc.json file in the home directory and delete it. Or create an empty .yo-rc.json file in the directory you want to use.

Newmann answered 12/2, 2015 at 15:45 Comment(0)
N
25

Thanks to issue page at https://github.com/yeoman/generator-angular/issues/1037#issuecomment-83118093 the solutions was relatively easy.

After the command mkdir my-new-project && cd $_ I needed to create an empty .yo-rc.json file with {} as content to this folder.

Then I could start yo and all files are created in my my-new-project folder now.

Newmann answered 18/3, 2015 at 18:59 Comment(0)
I
21

In case anyone else stumbles on this. The reason will be that a .yo-rc.json file is in the "wrong" directory.

Delete it and all will be well.

Intern answered 26/3, 2015 at 12:14 Comment(0)
J
6

This started happening to me after I ran yo from my home folder by mistake. Apparently I didn't clean up the generated files properly and left the ~/.yo-rc.json around. All you need to do is get rid of the .yo-rc.json in your home folder and run yo from your desired folder again.

Jayme answered 23/5, 2015 at 20:39 Comment(0)
S
3

Probably you have there .yo-rc.json file. You should delete all hidden files in home directory which yeoman created and it's should works.

Scraggly answered 13/4, 2015 at 10:57 Comment(0)
O
1

you should try not to install node with sudo, that causes your troubles. Take one instruction out of this link to install your node for usual user Instructions and it should work.

Otter answered 13/2, 2015 at 12:43 Comment(1)
Thanks, but my answer seems to be the right way for solving that problem.Newmann
D
0

I searched for .yo-rc.json file in the folder it wrongfully creates your project in, then showed all hidden files via "defaults write com.apple.finder AppleShowAllFiles YES" in terminal then reload Finder ( alt button + right click on finder icon) and deleted the hidden .yo-rc.json file and other hidden files that came with it. Then reloaded finder again after using the same command as above but replace YES by NO. That did it for me !

Dilapidated answered 27/6, 2017 at 17:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.