简体   繁体   English

在纱线全球添加generator-jhipster之后,你找不到jhipster

[英]yo cannot find jhipster after yarn global add generator-jhipster

I'm trying to generate a jHipster project using yarn - https://jhipster.github.io/installation/ 我正在尝试使用纱线生成一个jHipster项目 - https://jhipster.github.io/installation/

I installed Node from its website and yarn with brew. 我从其网站安装了Node,并使用brew安装了yarn。

yarn version 0.19.1 node version v7.5.0 OSX Sierra 10.12.3 纱线版本0.19.1节点版本v7.5.0 OSX Sierra 10.12.3

When I run yarn global add generator-jhipster , I could see jhispter generator being copied to /Users/{username}/.config/yarn/global/node_modules/ 当我运行yarn global add generator-jhipster ,我可以看到jhispter生成器被复制到/Users/{username}/.config/yarn/global/node_modules/

my-mac:~ user$ yarn global add generator-jhipster
yarn global v0.19.1
warning No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
warning undefined has no binaries
warning No license field
✨  Done in 30.68s.

As the next step, when I run yo jhipster , it cannot find jhipster. 作为下一步,当我运行yo jhipster ,它找不到jhipster。 However, when I run yarn add generator-jhipster , yo can find jhipster from current folder. 但是,当我运行yarn add generator-jhipster ,你可以从当前文件夹找到jhipster。 Not sure whats wrong with adding in global location. 不确定添加全球位置有什么问题。

my-mac:~ user$ echo $PATH
/usr/local/sbin:~/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/Cellar/node/7.5.0/bin:/Users/{user}/.config/yarn/global/node_modules/.bin

Will appreciate any help in identify whats going on or if there is any issue with latest yarn version. 我们将不胜感激,以确定最新的纱线版本是否存在任何问题。

my-mac:~ user$ yo jhipster
Error jhipster

You don’t seem to have a generator with the name “jhipster” installed.

I had the same problem and the cause was my laziness. 我有同样的问题,原因是我的懒惰。 I did not took time to read the notes of Local installation with Yarn documentation: 我没有花时间阅读使用Yarn文档的本地安装说明:

Note: if you have problem to use these tools globally, be sure you have $HOME/.config/yarn/global/node_modules/.bin in your path. 注意:如果您在全局使用这些工具时遇到问题,请确保路径中包含$ HOME / .config / yarn / global / node_modules / .bin。

On Mac or Linux: export PATH="$PATH:$(yarn global bin):$HOME/.config/yarn/global/node_modules/.bin" 在Mac或Linux上: export PATH="$PATH:$(yarn global bin):$HOME/.config/yarn/global/node_modules/.bin"

要解决这个问题,我需要在全球范围内使用纱线安装yeoman。

yarn global add yo

I am using Ubuntu and I faced this issue too. 我正在使用Ubuntu,我也遇到了这个问题。 Then I use sudo to add yo package 然后我用sudo添加你的包

sudo yarn global add yo

Hope this will helpful to you. 希望这对你有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM