generator-jhipster: JHipster should not install tabtab completions automatically
Overview of the issue
JHipster should not install tabtab completions automatically, it should ask permission to the user.
Motivation for or Use Case
It’s been a long time since I did run jhipster on Windows, in fact it was before jhipster cli was introduced and today I tried and I could not get it working.
One reason why Windows is a hard platform is because our users have many shells: cmd.exe, powershell and git bash are the most common ones. Cygwin can also be found.
So each time we mess with shell on Windows, we can be sure it won’t work for some users.
Currently, my problem is with tabtab (which does not work on Windows or may work with bash): it is installed by generator-jhipster using install script in package.json but no uninstall script.
Tabtab writes to a different global location based on type of shell it has detected, surprisingly this includes locations that require sudo rights according to their doc (I did not check) : /usr/local/share/zsh/site-functions, /usr/share/bash-completion/completions or /etc/bash_completion.d.
I think JHipster should not require sudo rights to install.
This forced installation creates another potential issue: it’s not versioned, tabtab writes stuff in a global location so if you have projects using different versions of jhipster, all of them will get completions from latest installation.
“jhipster upgrade” installs locally 2 versions of jhipster but we can’t tell it not to run tabtab, so a local installation results in global impact which is bad per se and in my particular case results in a failure.
upgrade failing due to tabtab
jhipster upgrade
Executing jhipster:upgrade
Welcome to the JHipster Upgrade Sub-Generator
This will upgrade your current application codebase to the latest JHipster version
Looking for latest generator-jhipster version...
New generator-jhipster version found: 4.6.2
Git repository detected
Created branch jhipster_upgrade
Cleaned up directory
Installing JHipster 4.6.1 locally
events.js:160
throw er; // Unhandled 'error' event
^
Error: [31m[1mERROR![22m[39m Something went wrong while installing the JHipster generator! yarn add v0.27.5
info No lockfile found.
[1/4] Resolving packages…
[2/4] Fetching packages…
[3/4] Linking dependencies…
[4/4] Building fresh packages…
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
error E:\projets\issues\upgrade\node_modules\generator-jhipster: Command failed.
Exit code: 1
Command: C:\WINDOWS\system32\cmd.exe
Arguments: /d /s /c tabtab install --name jhipster --auto
Directory: E:\projets\issues\upgrade\node_modules\generator-jhipster
Output:
module.js:471
throw err;
^
Error: Cannot find module ‘E:\projets\issues\upgrade\node_modules\issues\upgrade\node_modules\tabtab\bin\tabtab’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
It’s not ideal also for continuous integration either when you could have concurrency issues between different builds.
Reproduce the error
Related issues
Suggest a Fix
Get rid of tabtab in install script and prompt the user for installing it or document it as a pro tip.
JHipster Version(s)
4.6.2
JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
- Checking this box is mandatory (this is just to show you read everything)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 21 (21 by maintainers)
Commits related to this issue
- Ignore JHipster package.json scripts during upgrade Npm scrpits of generator-jhipster are useful for global installation but they are not required in teh context of an upgrade where the focus is on c... — committed to gmarziou/generator-jhipster by gmarziou 7 years ago
- Dont force users to install shell completions (tabtab) This "install" script is blocking too many users on Windows, let's disable it until we agree on how to do it with prompting the user. Fix #6162 — committed to gmarziou/generator-jhipster by gmarziou 7 years ago
@deepu105, Personally I’m not a big fan of tabtab and it’s approach to magically configure things (modifying personal conf files…). Although it always worked for me with nothing to do so it is still kinda cool… I suggest we move to a different approach which is writing completion scripts ourselves and creating a new
completioncli command. So runningjhipster completion bashandjhipster completion zshwill output the completion script.So people need to add the following line to their bashrc/zshrc:
source <(jhipster completion bash). This is the approach used by kubectl and I really like it. The shell is a little slower to startup but you are guaranteed that completions correspond to your current cli version. Also it will let us do much smarter completions.I think we clan close this issue as tabtab has been removed in 4.7.0 and we can open an improvement issue to track how to provide completion in a less intrusive way.
As a workaround you could try to add
--ignore-scriptsto yarn options as run by the maven plugin. 4.7.0 will include removal of the tabtab and should be released soon.