-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade fail under windows #6161
Comments
Can you try to generate app with npm instead of yarn in Windows?
@gmarziou I remember we had a similar issue recently but I couldn't find
it, do you remember?
…On Sun, 23 Jul 2017, 6:12 am Benjamin Qin, ***@***.***> wrote:
*Overview of the issue*
I tried to upgrade my code to 4.6.2 but encountered error:
$ jhipster upgrade
Executing jhipster:upgrade
Options:
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
Checked out branch "jhipster_upgrade"
Updating generator-jhipster to 4.6.2 . This might take some time...
Updated generator-jhipster to version 4.6.2
Cleaned up directory
Regenerating application with JHipster 4.6.2...
events.js:160
throw er; // Unhandled 'error' event
^
Error: ERROR! Something went wrong while generating project! '$' is not
recognized as an internal or external command,
operable program or batch file.
at Environment.error (C:\Users\Powerful User\AppData\Local\Yarn\config\global\node_modules\yeoman-environment\lib\environment.js:140:40)
at constructor.error (C:\Users\Powerful User\AppData\Local\Yarn\config\global\node_modules\generator-jhipster\generators\generator-base.js:1610:18)
at shelljs.exec (C:\Users\Powerful User\AppData\Local\Yarn\config\global\node_modules\generator-jhipster\generators\upgrade\index.js:86:23)
at C:\Users\Powerful User\AppData\Local\Yarn\config\global\node_modules\shelljs\src\exec.js:204:9
at ChildProcess.exithandler (child_process.js:211:5)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:886:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
*Motivation for or Use Case*
To help who encounter same issue under windows when upgrading a jhipster
generated project
*Reproduce the error*
Step 1:
yarn global upgrade generator-jhipster
Step 2:
jhipster upgrade
This error occurs in power shell AND git bash.
*Related issues*
None
*Suggest a Fix* *JHipster Version(s)*
Upgraded jhipster generator to 4.6.2 then try to upgrade my code base from
4.5.6 to 4.6.2
*JHipster configuration*
$ jhipster info
Executing jhipster:info
Options:
Welcome to the JHipster Information Sub-Generator
*JHipster Version(s)*
C:\code\sibodell-hse\hse-backend
`-- ***@***.***
*JHipster configuration, a .yo-rc.json file generated in the root folder* .yo-rc.json
file
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.bigcompany.hse",
"nativeLanguage": "zh-cn"
},
"jhipsterVersion": "4.5.6",
"baseName": "hse",
"packageName": "com.bigcompany.hse",
"packageFolder": "com/bigcompany/hse",
"serverPort": "8080",
"authenticationType": "jwt",
"hibernateCache": "ehcache",
"clusteredHttpSession": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "mysql",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSocialSignIn": false,
"jwtSecretKey": "replaced-by-jhipster-info",
"clientFramework": "angular1",
"useSass": false,
"clientPackageManager": "yarn",
"applicationType": "monolith",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "zh-cn",
"languages": [
"zh-cn",
"en"
]
}
}
*JDL for the Entity configuration(s) entityName.json files generated in
the .jhipster directory*
ls: no such file or directory: .jhipster/*.json
JDL entity definitions
*Environment and Tools*
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)
git version 2.12.2.windows.2
node: v6.10.2
npm: 5.0.4
bower: 1.8.0
gulp:
[12:11:04] CLI version 1.3.0
[12:11:04] Local version 3.9.1
yeoman: 2.0.0
yarn: 0.27.5
Docker version 1.12.5, build 7392c3b
docker-compose version 1.9.0, build 2585387
Execution complete
*Entity configuration(s) entityName.json files generated in the .jhipster
directory*
NONE (We generated some entities then moved the .json files to other
directory, this bug should have nothing to do with entities)
*Browsers and Operating System*
Windows 10 Pro
- [* ] Checking this box is mandatory (yes, I've read everything)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6161>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ABDlF4N0_SdJ348kpFelZbQEfMFh7s-Fks5sQshFgaJpZM4OgWfb>
.
|
Could you try with Few hints to help you debug this issue in your environment: The error about Sometimes I worked around this kind of issues by either:
Some users may have also a combination of npm and yarn folders in their PATH which makes it more tedious to debug. This is why sometimes npm could work better than yarn in such cases. |
Nodejs doc has specific instructions about executing Windows commands , upgrade.js uses shelljs.exec() which runs everything through cmd.exe on Windows by default (see doc). So we should be isolated from user's own shell. |
@iconben could you try to reproduce with shelljs in verbose mode? Just edit const shelljs = require('shelljs');
shelljs.config.verbose = true; I tried to reproduce but I have a more basic issue about tabtab that is unrelated but that I need to fix first. @deepu105 I think we should always set shelljs in verbose mode at least for the upgrade sub generator, just compare the 2 outputs below. shelljs in normal modejhipster 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 WARNING! local changes found. Please commit/stash them before upgrading events.js:160 throw er; // Unhandled 'error' event ^ shelljs in verbose modejhipster 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 ^ |
Related to the discussion #5883 I think we should reconsider to remove the upgrade sub generator, or at least, move to a specific project for people who want to maintain it. |
This sub generator is very important, personally I would prefer to keep it in core project. Also I don't know if it's feasible to add it to our CI but it could help. |
I like the sub-generator in core as well. I use it a a lot to upgrade sample apps w/o having to recreate them (or use a diff tool to manually upgrade).
When it works, it's an awesome feature! Maybe we should have some tests around it so we know when it breaks between upgrades. If that requires Windows hardware, or other things that cost $$, my company (Okta), is willing to sponsor.
Cheers,
Matt
… On Jul 23, 2017, at 09:19, Gaël Marziou ***@***.***> wrote:
This sub generator is very important, personally I would prefer to keep it in ore project.
It's just that it's too silent for all it does so when it fails, users has no idea what went wrong.
This is why I proposed a verbose mode for shelljs, this way we know exactly what fails and user can reproduce by running failing manually to debug.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Just as I wanted to have one of those Surface Pro laptop :-) |
Hi @deepu105, I had both yarn and npm installed and both have generator-jhipster at the begininng. As I didn't set up yarn global bin path environment then(I didn't complete yarn setup maybe because npm runs so far so good), I actually was using npm to upgrade my project, the error is the same (of course path of shelljs is different). The above error message I pasted was after I removed generator-jhipster under npm and enabled yarn global bin environment. My yarn global bin path: |
Hello @gmarziou , I just tried 'jhipster upgrade' with cmd.exe, same error: Regenerating application with JHipster 4.6.2... Error: �[31m�[1mERROR!�[22m�[39m Something went wrong while generating project! '$' is not recognized as an internal or external command, |
@gmarziou I tried shelljs in verbose mode, here is what I got:
|
Last time I had this issue was when I tried to upgrade from 4.5.4 to 4.5.6. I then manually executed the command that shelljs was trying to do (jhipster --with-entities --force --skip-install) and committed the jhipster-upgrade branch, then solved merge issues and merged to master. This time I think it should be something we have to fix. Not sure if this help: when I type this in cmd/shell: |
Interesting, this line looks suspicious to me : generatorCommand = this.clientPackageManager === 'yarn' ? '$(yarn bin)/jhipster' : '$(npm bin)/jhipster'; It can be expanded only in a unix shell and as shelljs.exec uses cmd.exe, it's normal that it fails So this bug affects all Windows users whatever shell they use. The fix should be to use shelljs to execute I'll work on it in few hours unless you want to do it in meantime @iconben |
Please go ahead @gmarziou and thanks a lot 👍 |
Unfortunately, I am unable to run the upgrade process, it always fails because of tabtab even after I completely wiped out yarn's node_modules dir and re-installed node. I'm completely puzzled. |
I changed line 82 from: generatorCommand = this.clientPackageManager === 'yarn' ? '$(yarn bin)/jhipster' : '$(npm bin)/jhipster'; to these two lines: let generatorDir = this.clientPackageManager === 'yarn' ? shelljs.exec('yarn bin') : shelljs.exec('npm bin'); Now it works. Out put around these lines are: ...... Notice there's output when shelljs.exec('yarn bin') run, should I mute it by adding a parameter { silent: this.silent }? Not familiar with shelljs. The code might be not robust and only tested on my win10 pro box so I'll leave it for your comments before starting a pull request. By the way this is done by directly modifying upgrade/index.js in yarn global bin directory. I guess there's no test case around upgrade feature in the generator project? |
Code was slightly changed to make eslint happy, please test/review, thanks. @gmarziou I mean I didn't setup a generator development environment yet. Yarn link works for me. |
@gmarziou we already use -v for version. we also have |
The more I learn, the more I realize how much I don't know ;) Hopefully your book will surely help. |
@gmarziou I'm bad at documenting stuff 😸 |
@gmarziou here is a sample usage https://github.com/jhipster/generator-jhipster/blob/master/generators/generator-base.js#L1904 |
Thanks, I will use it on the upgrade sub generator. |
The upgrade sugbenerator already has a |
yes good idea, I also think we should give an advice to user when an error is thrown during upgrade, something like "please run the same command with --verbose flag" |
Agree with this idea. It will definitely help when someone needs to troubleshoot (or at least to locate) errors. |
Overview of the issue
I tried to upgrade my code to 4.6.2 but encountered error:
$ jhipster upgrade
Executing jhipster:upgrade
Options:
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
Checked out branch "jhipster_upgrade"
Updating generator-jhipster to 4.6.2 . This might take some time...
Updated generator-jhipster to version 4.6.2
Cleaned up directory
Regenerating application with JHipster 4.6.2...
events.js:160
throw er; // Unhandled 'error' event
^
Error: ERROR! Something went wrong while generating project! '$' is not recognized as an internal or external command,
operable program or batch file.
Motivation for or Use Case
To help who encounter same issue under windows when upgrading a jhipster generated project
Reproduce the error
Step 1:
yarn global upgrade generator-jhipster
Step 2:
jhipster upgrade
This error occurs in power shell AND git bash.
Related issues
None
Suggest a Fix
JHipster Version(s)
Upgraded jhipster generator to 4.6.2 then try to upgrade my code base from 4.5.6 to 4.6.2
JHipster configuration
$ jhipster info
Executing jhipster:info
Options:
Welcome to the JHipster Information Sub-Generator
JHipster Version(s)
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryls: no such file or directory: .jhipster/*.json
JDL entity definitions
Environment and Tools
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)
git version 2.12.2.windows.2
node: v6.10.2
npm: 5.0.4
bower: 1.8.0
gulp:
[12:11:04] CLI version 1.3.0
[12:11:04] Local version 3.9.1
yeoman: 2.0.0
yarn: 0.27.5
Docker version 1.12.5, build 7392c3b
docker-compose version 1.9.0, build 2585387
Execution complete
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryNONE (We generated some entities then moved the .json files to other directory, this bug should have nothing to do with entities)
Browsers and Operating System
Windows 10 Pro
The text was updated successfully, but these errors were encountered: