Closed ltfschoen closed 1 year ago
Hey @ltfschoen,
Try out v1.24.0 which was just released. That should hopefully take care of the nvm issue.
With the problem with login, I'll take a look - I know we had a domain change for the redirect not that long ago, so maybe something broke....
@dtarnawsky thanks for your prompt response!
i just tried updating to v1.24.0, then restarted VSCode
then i first tried Remote Explorer via SSH to the Ubuntu 22.04 LTS machine
it still doesn't let me login, clicking "Login" just redirects to http://localhost:8123/?code=xxx with error ERR_CONNECTION_REFUSED
, and in the VSCode Output it displays:
[[40mINFO[49m] During this process, a browser window will open to authenticate you. Please leave this process running until authentication is complete.
--confirm: Open the browser to log in to your Ionic account? Yes
Error: Cannot start local server. Port 8123 is in use.
at OpenIDFlow.getAuthorizationCode (/root/.vscode-server/extensions/ionic.ionic-1.24.0/node_modules/@ionic/cli/lib/oauth/oauth.js:61:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async OpenIDFlow.run (/root/.vscode-server/extensions/ionic.ionic-1.24.0/node_modules/@ionic/cli/lib/oauth/oauth.js:33:33)
at async ProSession.webLogin (/root/.vscode-server/extensions/ionic.ionic-1.24.0/node_modules/@ionic/cli/lib/session.js:142:23)
at async LoginCommand.run (/root/.vscode-server/extensions/ionic.ionic-1.24.0/node_modules/@ionic/cli/commands/login.js:157:17)
at async Promise.all (index 0)
at async LoginCommand.execute (/root/.vscode-server/extensions/ionic.ionic-1.24.0/node_modules/@ionic/cli/lib/command.js:81:9)
at async Executor.run (/root/.vscode-server/extensions/ionic.ionic-1.24.0/node_modules/@ionic/cli/lib/executor.js:54:9)
at async Executor.execute (/root/.vscode-server/extensions/ionic.ionic-1.24.0/node_modules/@ionic/cli-framework/lib/executor.js:70:13)
at async Object.run (/root/.vscode-server/extensions/ionic.ionic-1.24.0/node_modules/@ionic/cli/index.js:110:9)
and running lsof -i -P -n | grep LISTEN
/ lsof -n -i :8123 | grep LISTEN
output
ionic 692623 root 18u IPv6 12318070 0t0 TCP [::1]:8123 (LISTEN)
so i killed the port
kill -9 692623
But when i closed VSCode and tried again it had the same issue.
i also tried clicking the following and discovered that it still doesn't seem to be recognising yarn
associated with the installation of Node.js from the .nvmrc file
VSCode > click Ionic Extension icon > Settings > Remote Logging
--confirm: Open the browser to log in to your Ionic account? Yes
[Ionic] Remote logging service has started at http://<MY_PUBLIC_IP>:8942
[Ionic] Installing @ionic/remote-log
[Error] /bin/sh: 1: yarn: not found
there appears to be a change in that it appears to detect the .nvmrc file because when click "Skip without Login" the Output shows:
[Ionic] Detected nvm (v19.6.0
) for this project.
and when i click "Debug > Web"
but as you can see from the logs, it tries to open the app in the Chrome browser that pops up, but then it suddenly closes and this appears
so then i clicked to open .vscode/launch.json,
and changed the port from 8080 to 8100, since that's the port configured in Settings for the Ionic Extension
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8100",
"webRoot": "${workspaceFolder}"
}
]
}
and tried "Debug > Web" again, which output:
but the errors indicate that it still can't detect Yarn.
notice how at once stage it shows External: http://<MY_PUBLIC_IP>:8100
, but later is showsNetwork: unavailable
and the browser window doesn't load at all.
and it displays this error indicating that port 8100 is in use, even though when i ran lsof -n -i :8100 | grep LISTEN
on the remote server it didn't show that port in use at all...
but then i later realised it was because it was running on localhost:8100 (my local machine), and running $ lsof -n -i :8100 | grep LISTEN
output:
node 15693 luke 23u IPv4 0x58ee4edc323a80b1 0t0 TCP *:xprint-server (LISTEN)
so i killed it with kill -9 15693
and retried, but still same outputs in VSCode Output due to not being able to find Yarn.
so it doesn't find Yarn on remote server...
then secondly tried on my Local Machine (macOS) machine it also still doesn't let me login, clicking "Login" just redirects to http://localhost:8123/?code=xxx with error. there also appears to be a change in that it appears to detect the .nvmrc file because when click "Skip without Login" the Output shows:
[Ionic] Detected nvm (v19.6.0
) for this project.
and when i click "Debug > Web" it outputs the following:
then i tried restarting VSCode, and i think i ran lsof -n -i :8100 | grep LISTEN
and kill -9 <PID>
to kill whatever was running on that port 8100, but maybe i didn't, and then tried it again on local machine, it found .nvmrc, then output some error [Error] npm ERR! code ELSPROBLEMS
, then according to the logs it still [npm] Error: listen EADDRINUSE: address already in use 0.0.0.0:8100, but eventually it loaded successfully on port 8100
then lastly i closed VSCode and the browser tab, and restarted it localhost.
i checked with lsof -n -i :8100 | grep LISTEN
but didn't stop the process running on port 8100,
and did the usual "Debug > Web" and it chose to use port 8101 instead and loaded successfully.
so on localhost it appears to use NVM successfully, i'm just not sure what caused the [Error] npm ERR! code ELSPROBLEMS
error (although it automatically resolved that error)
credits: https://gist.github.com/pierrejoubert73/902cc94d79424356a8d20be2b382e1ab
Hey @ltfschoen,
Try out v1.24.0 which was just released. That should hopefully take care of the nvm issue.
With the problem with login, I'll take a look - I know we had a domain change for the redirect not that long ago, so maybe something broke....
hey @dtarnawsky don't mean to bother you, but any updates on investigating the login issue?
In 1.34.2 we fixed a login issue (The extension uses the Ionic CLI and v7.0.0 had a bug with ionic login
that was fixed in 7.0.1).
Ubuntu-based / Linux machines are not something I've actively tested against. I generally test Mac Silicon and Intel as well as Windows. Sounds like something I should try.
Closing for now as login issue was resolved.
I guess the bug is still around? Using Ubuntu 23 with the latest vscode and latest ionic extension.
It seems. Also tried to set shell path to /bin/zsh on plugin settings (because I'm using ZSH and did the nvm setup on my .zshrc) . The plguin still not able to find nvm installed node/npm. Tried to provide the path for npm executable like this:
PATH=$PATH:/home/sudosu/.nvm/versions/node/v20.9.0/bin /bin/zsh
The script probably can find the npm executable, but still failing.
i just started using an existing Ionic project https://github.com/svub/lets-stay-in-touch
i wanted to add instructions to that repos README file with the changes i'd made in this PR https://github.com/svub/lets-stay-in-touch/pull/15 with the way i'd installed it on a fresh installation of Ubuntu 22.04 LTS that i am remotely accessing via SSH on Linode using the Remote Explorer SSH approach in VSCode.
I want to use remote machines because my local machine is an old 2 cpu macOS, and i do Rust programming where the compile time might be ~3 hrs on my local machine vs paying for a remote machine that'll compile it >10x faster. also shaves off time on some larger frontend projects.
nvm use
(since it detects the .nvmrc file that containsv19.6.0
and automatically installs that version)nvm use
but then i discovered this Ionic Visual Studio (VS) Code Extension and realised it would a good workflow for debugging so i installed the extension, clicked the Ionic icon, and clicked Login (i originally assumed it logged me in somehow, but it doesn't say it has or hasn't logged me in, and i later found out it should have redirected me to ionic.io/login to login, which it doesn't do), but then it displayed this error in the Visual Studio Code Ionic terminal:
then i clicked "Debug > Web" and it displayed the following in the Ionic terminal:
Sometimes it even says
/bin/sh: 1: node: not found
i searched the web for a solution some suggested editting settings.json with CMD+ SHIFT + P > Preferences: Open Settings (JSON) and changing to:
so i did that and restarted the VS code window but that didn't fix the error. i tried adding the following to ~/.bash_profile too and then running
source ~/.bash_profile
, and repeated for ~/.profile but that still produced the same errors.i tried running
. ~/.nvm/nvm.sh
but that didn't help either.so i don't know how to configure the whatever PATH VSCode is using so it can find npx and npm.
but if i just install a version of Node.js using NodeSource without using NVM
then restart VSCode, when i click the Ionic icon, and then press Login, it actually logs me in properly by opening my browser ionic.io/login, which i did and logged in, then clicked "Resend verification email", and verified it, and it logged me in But VSCode still said "Complete the login in the web browser. This view will change as soon as you log in.", but that view still hadn't changed. So i logged out and logged back in in the browser but it still didn't update VSCode to log me in there too. So i closed the VSCode window and opened it again, and clicked Login, and it automatically opened the browser at https://ionicframework.com/oauth/authorize?audience=https%3A%2F%2Fapi.ionicjs.com&scope=openid%20profile%20email%20offline_access&response_type=code&client_id=cli&code_challenge=&code_challenge_method=S256&redirect_uri=http%3A%2F%2Flocalhost%3A8123&nonce=, and then continued to redirect to http://localhost:8123/?code=
and displays error ERR_CONNECTION_REFUSED (i'm using latest Brave browser), and then it just showed the Sign Up or Login screen again in VSCode.
note: i've omitted the values that were shown for
<CODE>
,<CHALLENGE_CODE>
, and<NONCE>
note that it opened http://localhost:8123/?code=
, i was surprised that it didn't open http://:8123/?code=
, since i wasn't working on my local machine....
so then i tried doing the same thing on my local machine to see if that'd work (slow old macOS). note: i don't actually want to work on my slow local machine
Then in VSCode i realised i had to install the ionic extension Ionic.ionic again for some reason. Then i clicked the Ionic icon, and clicked Login, and it redirected me to http://localhost:8123/?code=
, and then it displayed "You are authenticated!"
(i tried using that same code
at the link http://:8123/?code=
to try and login so i could use Ionic with VSCode with the Remote Explorer connect instead of my local machine but that didn't work)
And this time it actually logged me in, but then i realised i realised i hadn't updated to Yarn 3.4.1, and then i noticed i'd run
yarn
before running the command to update from Yarn 1 to Yarn 3, so i rancorepack enable && corepack prepare yarn@stable --activate && yarn set version 3.4.1 yarn global add @ionic/cli@latest native-run cordova-res
and thenyarn global add @ionic/cli@latest native-run cordova-res
, but it gave errorUsage Error: The 'yarn global' commands have been removed in 2.x
, so i didyarn dlx @ionic/cli@latest native-run cordova-res
install and that worked, and then ranyarn
then i opened VSCode and clicked Ionic icon > Debug > Web, and it compiled ok:
and it automatically opened localhost:8100 and worked great!