Closed ddenev closed 3 months ago
Hi @ddenev! π
It looks like you provided an invalid or unsupported reproduction URL. Do not use any service other than Codepen, jsFiddle, StackBlitz, Codesandbox, and GitHub. Make sure the URL you provided is correct and reachable. You can test it by visiting it in a private tab, another device, etc. Please edit your original post above and provide a valid reproduction URL as explained.
Without a proper reproduction, your issue will have to get closed.
Thank you for your collaboration. π
I have updated the OP - added a dummy URL since this cannot be reproduced on the web - it is a CLI issue that needs to be run locally on the machine.
@ddenev a dummy URL won't do any help, the aim is to get a useful reproduction. You can create a GitHub repo in this case, it's one of the options listed. Even if it's a dead simple project, a repro can still help to understand whether there is a problem with the lock file, some basic configuration, certain package versions, etc.
@yusufkandemir, thanks for replying but I think you haven't read the OP in full. If you pay closer attention to the problem, you will observe that it has nothing to do with the Quasar project itself but is a bug withing the core quasar package.
You can simply create a new Quasar project with yarn create quasar
and then initialize Capacitor (as I already described in the reproduction steps above).
You would also need to install Android Studio in order to be able to reproduce the issue and this is not possible to do in a URL :)
If you still insist on having a URL, I will just create a fresh Quasar project and give you the link to it but again - the problem is NOT related to a project.
Please, do read the investigation I've done above. I've tested it and it works with return
.
Here are the exact steps to reproduce:
yarn create quasar
(use Vite and accept defaults)cd quasar-project
quasar mode add capacitor
quasar build -m capacitor -T android --ide
The result is - IDE is not launched.
@ddenev I've read your post but I think you haven't read my message and ignoring my open-source maintainer experience. I've seen a lot of cases where some people experience a problem with a freshly created project whereas we can't reproduce the problem when we create one. It sometimes turns out to be some local configuration, a really weird case, order of executing commands, choosing certain features or not. The code you suspect of being incorrect is 2 years old and it has been perfectly working since.
https://github.com/quasarframework/quasar/blob/d51ad0391dd15d94ffbd4a17f8965ddd882528ab/app-vite/lib/helpers/open-ide.js#L133 The Android Studio launch request may be initiated very slowly due to having a slow machine, running programs such as antiviruses which could slow down launching programs, a problem in Windows, or even NodeJS.
My first recommendation is to update Node to v20.16.0 and even try the latest v22. If you have pending Windows updates, do them. Try restarting the machine. If those don't work, please increase the timeout slowly until you find a value that works and share it with us. If it's something acceptable like 400-500, we should be able to update it. However, if it's more than that, I can safely say there is something wrong in your setup.
@yusufkandemir
I know that it's a 2 years old code, I've seen the git blame.
Again, I would gently insist you read the OP in detail:
quasar dev...
the IDE is launched and that when running quasar build...
the IDE is not launched - this definitely speaks that there is nothing wrong with my machine, programs, Windows, NodeJS, etc., since it is perfectly able to initiate the IDE launch. Also, the machine is powerful enough (Core i7 13th Gen with 32GB RAM).process.exit(0)
statement - this statement kills the JS process and does not allow the tasks that should run after the build step to run. This is clearly obvious when you look at the screenshots I provided above:
process.exit(0)
the output is cutreturn
the process finishes properly and the output is completeThe fix is pretty simple - just replace the process.exit(0)
with return
.
I think that increasing the timeout is not a solution - since the process is currently killed and cannot finish properly (see 2 above and the screenshots).
Here is another proof. Please observe this code: https://github.com/quasarframework/quasar/blob/d51ad0391dd15d94ffbd4a17f8965ddd882528ab/app-vite/lib/cmd/build.js#L161-L167
The build()
function above calls the openIde
function:
https://github.com/quasarframework/quasar/blob/d51ad0391dd15d94ffbd4a17f8965ddd882528ab/app-vite/lib/modes/capacitor/capacitor-builder.js#L49-L52
As you can see, build()
cannot be resolved since it is killed and therefore nothing in the then()
block can be executed:
https://github.com/quasarframework/quasar/blob/d51ad0391dd15d94ffbd4a17f8965ddd882528ab/app-vite/lib/cmd/build.js#L161-L205
and there is a lot going on in that block.
When you replace process.exit()
with return
the build()
function will properly return a Promise and it will be properly resolved.
@yusufkandemir, try to configure an afterBuild
hook in your quasar.config.js
and you'll see that it is not called.
Just seeing all these messages now. Took care of it for the q/app-vite & q/app-webpack betas. Now backporting to current q/app-vite & q/app-webpack.
You will see that I have clearly stated that when running quasar dev... the IDE is launched and that when running quasar build... the IDE is not launched - this definitely speaks that there is nothing wrong with my machine
No, because the dev process is an ongoing one, while the build process waits just enough so that the OS starts launching the IDE and then the build process quits. If anything between the Node-OS communication is making it slower, then the situation ends up being the build process exiting before the IDE has been launched successfully.
However, the other points you've raised in your message are valid. The fix is not as simple as changing process.exit(0)
to return
. As a side effect of addressing the other points, your problem regarding the IDE not opening should also be fixed.
thank you both @rstoenescu and @yusufkandemir
The afterBuild
hook (and everything else that follows the IDE opening) will not (and should not be called) because the process has been interrupted by requesting to manually finalize the build through the IDE.
yes, that's a fair point, didn't think about that. then I guess, indeed, 300ms is just not enough to allow the IDE launching to be initiated before the process exits.
I also like the build summary (see the 2nd screenshot in the OP above) that was not shown when exiting with process.exit()
π
Fix will be available in:
@ddenev Would you be so kind to open up a new ticket for the build summary pls?
@ddenev Would you be so kind to open up a new ticket for the build summary pls?
sure!
What happened?
When running the
quasar build -m capacitor -t android --ide
command, the Android Studio IDE is not launched.On the other hand, when running a dev build -
quasar dev -m capacitor -t android
- the IDE is launched without a problem.After digging into it, the problem seems to come from the following statement in
app-vite/lib/modes/capacitor/capacitor-builder.js
:If I replace
process.exit(0)
withreturn
, everything works ok - Android Studio is launched.This is the console output when running with
process.exit(0)
:This is the console output when running with
return
:What did you expect to happen?
Expected the IDE to be launched
Reproduction URL
https://codepen.io/ddenev/pen/PorjvGL
How to reproduce?
quasar build -m capacitor -t android --ide
Note: No reproduction URL provided as this cannot be reproduced on the web, it's a CLI issue.
Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite), Cordova Mode, Capacitor Mode
Platforms/Browsers
No response
Quasar info output
Relevant log output
No response
Additional context
I haven't tested, but I suppose the same problem exists with Cordova builder as well.