yeoman creates project in Desktop even though I CD into directory

我怕爱的太早我们不能终老 提交于 2019-12-02 19:51:15

问题


I am having a issue creating a yeoman project. I cd in the directory type yo and it says:

Here is it suppose to asked me project name etc and it wants to throw everything on my desktop not the file I cd into. It defaults to mvn and I want gradle. I even npm uninstall -g generator-jhipster and reinstalled it and got the same issue.


回答1:


If you have a .yo-rc.json file in a parent directory, Yeoman will load that configuration and generate from that file instead of prompting. This allows developers to run a yo command from any folder in the project and have it apply to the correct files.

To solve this, remove the .yo-rc.json from the parent directory, in your case /Users/drew/Desktop.

For example, if you are in the directory /Users/drew/Desktop/new-project but /Users/drew/Desktop has a .yo-rc.json inside, Yeoman will change to the parent directory (Desktop), load the configuration, and generate the files from that folder instead of the child folder.




回答2:


Based on your log it's looks like you are running yo in a folder where a .yo-rc.json is already existing. Careful under windows the .yo-rc.json can be that is of type hidden and you can't see it in explorer. Because of an existing .yo-rc.json you are not asked anymore for info e.g. project name, build tool etc. My recommendation will be to create a new folder run inside yo command



来源:https://stackoverflow.com/questions/43835475/yeoman-creates-project-in-desktop-even-though-i-cd-into-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!