即使我将CD插入目录,yeoman也会在Desktop中创建项目 [英] yeoman creates project in Desktop even though I CD into directory
问题描述
我在创建一个yeoman项目时遇到问题.我在目录类型为yo
的cd中说:
I am having a issue creating a yeoman project. I cd in the directory type yo
and it says:
这里是要问我项目名称等,它想将所有内容扔到我的桌面上而不是我放入的文件.它默认为mvn
,我想要gradle.我什至npm uninstall -g generator-jhipster
并重新安装它,并遇到相同的问题.
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.
推荐答案
如果父目录中有.yo-rc.json
文件,Yeoman将加载该配置并从该文件生成而不是提示.这样,开发人员可以从项目中的任何文件夹运行yo
命令,并将其应用于正确的文件.
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.
要解决此问题,请在您的情况下,将.yo-rc.json
从父目录中删除/Users/drew/Desktop
.
To solve this, remove the .yo-rc.json
from the parent directory, in your case /Users/drew/Desktop
.
例如,如果您在目录/Users/drew/Desktop/new-project
中,但/Users/drew/Desktop
里面有一个.yo-rc.json
,Yeoman将切换到父目录(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.
这篇关于即使我将CD插入目录,yeoman也会在Desktop中创建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!