Vscode interfering with npm GitHub install - github

Today npm started to act up when I executed npm i <github repo> inside a VSCode terminal.
The action was interrupted by a VSCode popup window
"Image: The extension GitHub wants to sign in using GitHub."
I [Cancel]'ed that popup, but npm still hung.
This time two popups occurred in vscode asking me for username and password.Image: VSCode input dialogues for username and password
I [ESC][ESC]'ed out of those, but the same thing happened a second time.
I avoided that too by doing [Cancel][ESC][ESC] again.
Despite my actions to "ignore" the interruption, the GitHub library actually got installed (Hurray).
Retrying the same install in a terminal outside VSCode, did not show the same interruption.
Does anybody know how I can get rid of this annoying interference from VSCode?
It should be noted that there are no GitHub extension showing in the VSCode extension list.
Is there some internal GitHub extention in VSCode?
I already have perfectly good SSH-key credentials for GitHub that works well with npm outside VSCode. I do not see why I should spread my credentials to VSCode as well.
Regards,
Erik
VSCode 1.48.2,
Ubuntu 18.04.5 LTS

I had this problem too, and only found suggestion of setting
"github.gitAuthentication": false,
This stopped the first popup you describe, but I could still not suppress the second Git username and password dialog. I've found that to stop that, it is also necessary to set:
"git.terminalAuthentication": false,
Note: The integrated terminal will need to be exited/restarted for this to take effect.

Related

github login and sync failure in updated vscode linux version

recently I installed a fresh version of the KDE neon user edition and I updated it and works fine.
I also installed the vscode Debian version and nothing is wrong.
but when I want to login with my GitHub account in vscode for configs sync it opens a firefox tab that I log in to my GitHub and authorizes the vscode and it succeeds and gets back to vscode and instead of signing in and syncing the configs it opens an empty unsaved file named something like this:
did-authenticate\?windowid\=1\&code\=6beea2fcb8a47e0ea49e\&state\=2efc5efd-9c68-4735-a4a0-fd690dd7aec0
in this path : "~/vscode:/vscode.GitHub-authentication"
and after a few seconds canceled notification appears.
I've installed vscode for Debian version 1.63.2 which people in this Github issue had the same problem in version 1.62.2 and they are saying that this problem is fixed for them in version 1.62.3.
I don't have this problem with the Microsoft account sign-in.
what am I missing?
Update:
for testing, I tried to install an extension for vscode and I pasted the URL with vscode protocol in a web browser like this (vscode:extension/GitHub.vscode-pull-request-github), and instead of opening the vscode extensions tab, it goes back to vscode and opens an empty file in the same directory ("~/vscode:/vscode.GitHub-authentication").
so this is vscodes fault that cant handle the vscode: URLs.
I found out what the problem is but I don't know how to fix it
for the record I've updated the vscode today to the 1.64.1 version and still have the problem.
enter image description here
First, you need to get the GitHub Pull Requests and Issues and GitHub extensions together. Then go to the section specified in the photo and give the details of the account and repository you are using. And then it will be fixed.
I ran into this issue myself and discovered that it's because the VS Code command-line application isn't designed to handle URLs, but local file paths. VS Code registers the vscode:// URL scheme with XDG using an appropriate *.desktop file and these URLs should be opened using the command-line program xdg-open. In Firefox, if you have not yet set a default application for vscode:// URLs, then it will ask you for a program to open it with, select /usr/bin/xdg-open. If you have already set it to a different default, you can change it as follows: go to the Menu -> Settings -> General -> Applications -> vscode -> Use other... -> Select /usr/bin/xdg-open as the program for vscode.
With the default for vscode:// URLs set to use xdg-open, then any future integration with VS Code should work naturally to open it as expected.

GitHub Copilot Commands not working and showing error

I have installed GitHub Copilot just for the sake of testing. However, none of the commands work.
For example if I try CTRL + Enter I get this error message:
command 'github.copilot.generate' not found
I am trying it with JS file.
I have latest Visual Studio Code and Copilot installed.
Click on the bell button on bottom right-corner of the Visual Studio Code Editor
Press 'Agree' button
Thats it!
I had already signed up for the Technical preview and also accepted the invite for the same. Even after being signed in to VS Code using the same account, I had this error. This solution worked for me:
Sign out of my account from the Accounts section of the left
sidebar on VS Code
Sign in again using the same account in which invite was received
NOTE: There is a thread on the official Copilot discussion board on this issue here.
I have access to Github Copilot as well but get the error:
command 'github.copilot.generate' not found
Tried reloading and reinstalling it as well through vscodes ui.
Went in and manually went through the process of completely deleting it explained here.
Afterward, I logged out of my Github account attempted to install Copilot then logged back in when the prompt was displayed, again no luck.
Tested running both CTRL+ENTER and Alt+\ , neither of them did anything.
After I tried:
Developer: Reload Window
But that didn't do anything.
Checked the discussion forums and they had a solution for:
command 'github.copilot.toggleCopilot' not found
Which was to simply uninstall then reinstall copilot then run CTRL+R (Developer: Reload Window), this too didn't work out.
There's a good chance that all you'd have to do is retrigger the authentication flow considering that the developer tools console reports that copilot is "missing an auth token" (but no one knows how to retrigger it).
In addition to the above, I tried running CTRL+SHIFT+P then ran "Open Copilot", which resulted in the error
Command 'Open Copilot' resulted in an error (command 'github.copilot.generate' not found)
From this discussion post on another forum with a similar issue, apparently, this is an issue with command registration.
This specific comment seemed most relevant
Uninstall Python extension (if you have pylance uninstall it first).
Close all instances of VS Code.
Go to,%USERPROFILE%/.vscode/extensions (on windows) or
~/.vscode/extensions on Linux/Mac.
Delete any folder with the name starting with ms-python.python*
Start VS Code, and install Python extension (also pylance if you
uninstalled it in step 1).
Of course, you'd have to apply this to Copilot so...
Uninstall Copilot
Close all instances of vscode
Go to, %USERPROFILE%/.vscode/extensions (on windows) or ~/.vscode/extensions on Linux/Mac.
Delete all instances of Copilot
Go to, %USERPROFILE%/AppData/Roaming/Code/CachedExtensionVSIXs
Delete all instances of Copilot
Start and install Copilot
This too didn't work.
If I were to guess this would be solvable via retriggering the authentication flow.
(1) Go to, %USERPROFILE%/AppData/Roaming/Code/CachedExtensionVSIXs
(2) Delete all files and reopen vsCode.
This happens when you have failed to authenticate Copilot with Visual Studio Code.
If you had a missed authentication flow the flow can be re-triggered by clicking the VSCode Notifications icon on the status bar and clicking on the Sign in to Github notification.
If you have lost the authentication flow notification from the notifications panel, re-installing the Copilot helps.
TIP: To make it easier to sign in, make sure you are already authenticated on github.com on the default browser.
You can open the extensions tab or press ctrl + shift + x to look at the copilot extension.
you may reload it if you have authenticated with your GitHub account before.
Step 1:
First you need to login with same Github account you use for copilot beta signup, in your default browser.
If you mistakenly did something wrong here, just uninstall the extension and reload it, and then repeat step 1.
I don't know how this ties in but maybe it will help.
I have several times gotten a page saying that Copilot installed but wasn't done yet, and that I could finish the process by pasting an auth code into the "sign on to Github" link found in the VSCode status bar.
No such sign-on link ever showed up in my status bar but the auth code looked like this:
vscode-insiders://vscode.github-authentication/did-authenticate?windowid=1&code=65....
but I have found no place I can run that where it produces the desired result. At best I end up back at the waitlist sign on page.
Just log out your github account and re-log-in it in VSCode
In OSX this worked:
On a previous try, I had logged in to the wrong GitHub account. Be sure to be logged in with the correct GitHub account in the browser. Delete the extension from VSCode. Then open the Keychain Access -app and delete GitHub keys from there. After that install the extension and now it gets the correct authorization.
I found that the reason was because my account never prompted me to allow the access as one of the top answers shows. It may have something to do with a firewall or other permissions (or bugs) on your machine. If you have access to another computer you can try to use Co-Pilot and see what happens. For me, everything worked on the second computer. Then you could compare and see what is different. In my case, it was my work's VPN that didn't allow. Once I disconnected from the VPN or tried another device, it worked fine.
Check if you behind a firewall or proxy
Have you got the copilot beta? If not, you cant use it!
Updating Github Copilot helped (for NVim + Vundle I did :BundleUpdate).

Error loading webview: Error: Could not register service workers: TypeError: Failed to register a ServiceWorker for scope

When I update my VSCode to v1.56.2 and open webview, I get these messages:
Error loading webview: Error: Could not register service workers:
TypeError: Failed to register a ServiceWorker for scope
('vscode-webview://867f875b-c5a3-4504-8de2-2e8614bdc0f8/') with script
('vscode-webview://867f875b-c5a3-4504-8de2-2e8614bdc0f8/service-worker.js?platform=electron&id=867f875b-c5a3-4504-8de2-2e8614bdc0f8&vscode-resource-origin=https%3A%2F%2F867f875b-c5a3-4504-8de2-2e8614bdc0f8.vscode-webview-test.com'):
ServiceWorker cannot be started.
How can I solve this issue?
If you are using Ubuntu, there is probably another (maybe hidden) vscode process, which is causing the problem.
Close the vs code first and in terminal try: killall code.
In Windows, you can simply fix this error by clearing the cache for VSCode. Please follow the steps below:
Close VSCode and also kill any background processes running in the task manager.
Go to the file explorer and to the path C:\Users\<user_name>\AppData\Roaming\Code and clear the contents of the folders Cache, CachedData, CachedExtensions, CachedExtensionVSIXs (if this folder exists) and Code Cache.
Open VSCode and you are good to go.
I encountered this issue and am not a Windows user, so this is my resolution:
I found that there was an instance of VS Code open that was erroneously not shown on my dock. I closed this instance and opened a new instance. The problem was gone.
I think the issue happened because I had a VS Code instance open, allowed a software update to run in the background, postponed the restart, opened a new and updated VS Code instance, and the old instance remained open causing conflicts.
OS: Ubuntu 20.04.2 LTS
#tritemio on GitHub has a great answer:
https://github.com/microsoft/vscode/issues/125993#issuecomment-912439561
in short, delete cache folder:
rm -rf ~/.config/Code/Cache
This is a known bug in VS Code 1.56. It happens for some Windows users when running VS Code as an administrator
As a workaround, you can try launching VS Code with the --no-sandbox command line flag:
$ code --no-sandbox
#tritemio, thanks for sharing.
This also seemed to solve my issues on Windows for "Extensions - Details View", "VS Code Release Notes View", "Gitlab integrated Interactive Rebase Editor", etc.
I followed your suggestion and deleted the following folders;
%appdata%\Code - Insiders\Cache
%appdata%\Code - Insiders\Code Cache
On *nix systems, first close VS Code app then run pgrep -f '/Applications/Visual Studio Code.app' | xargs kill to clean up vscode's processes. Reopen vscode and the issue will be gone.
If on macOS, you can run the above command verbatim. If you're not on macOS or installed vscode on a different location, you need to change the argument passed to pgrep. You can run ps auxww | command grep -i --color code to find the path of vscode's running processes.
Happened to me when started code in windows cmd. Closed vs code and opened it from my taskbar shortcut instead, and the error was gone
The simplest solution for this problem in any version of Linux is simply to close other instances of VS code and use only one instance of VS code.
OS: Linux 20.04.3 LTS
I've also encountered the same "Error loading web view" Error.
I've solved this issue by moving "vscode.app" into "Application folder" instead of "Download folder" on macOS.
I'll describe my "symptom" here.
OS: macOS 12.0.1
Installed 2 versions of vscode somehow, 1 under "Application folder", another under "download folder"
Run both vscode at the same time, the "download folder" version has no error display plugin pages, the "Application folder" version has the "Error loading webview" error
Checked and see 2 vscode instances running in the background
What I tried to solve this issue:
Tried to kill "download folder" instance, and the error remains for "application folder" instance
Moved "download folder" to "application folder" and both vscode works correctly on plugin page!
What I suspect on what the problem is?
Maybe these 2 vscode are sharing the same resource(could be some shared file), however they have different permissions since one is under application folder and another is under download folder.
This answer applies if using VSCode in GitHub Codespaces in Firefox or Brave browsers. I had to disable "Enhanced Tracking Protection" for the site, and that is all. To do so, click on the shield icon which is to the left of the displayed web address.
If anyone is using Brave, please turn off the brave shields as well.
For Mac/Apple computer Monteray version the following steps worked for me:
Delete VSCode from downloads folder.
Turn off VSCode
Open Activity Monitor and delete VSCode "Code" process.
Try closing all the process cmd+qof vscode and reopen vscode and everything should work well.
I have just restarted VS code and it worked for me. OS was Windows 10.

Terminal started behaving badly when Zshell theme is present

Originally from here.
Versions:
VSCode Version: 1.46.1
OS Version: Windows_NT x64 10.0.20161
Steps to Reproduce:
Install debian-dev-boilerplate inside WSL.
Setup powerlevel 10k.
Clone a git repo and enter its folder.
git clone git#github.com:DanielAtKrypton/debian-dev-boilerplate.git
cd debian-dev-boilerplate
You should now see something like:
Open vscode from zshell. By typing at the zshell prompt:
code .
At this point the bug is revealed when the terminal is opened for the first time inside vscode. At first glance, the terminal renders correctly the powerlevel10k theme. After half a second, the theme is deactivated as can be seen in the next picture.
Does this issue occur when all extensions are disabled?:
Yes. The first time vscode is launched, it installs a vanilla (with no extensions) vscode-server to the linux distro. And still the bug happens.
It is interesting to note that in prior vscode versions this functionality was working alright. For any reason I don't know this issue started to happen in the last couple weeks.
Additional Info:
Here is the log file when running the commands:
code . --log trace
exthost.log
Most likely Powerlevel10k has been installed and/or loaded from ~/.zshrc incorrectly. The screenshot of VS Code shows robbyrussell theme, so I surmise that you are using Oh My Zsh. To install Powerlevel10k on top of Oh My Zsh you need to follow these instructions:
Run: git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.
Try running grep -E 'ZSH_THEME|/powerlevel10k' ~/.zshrc. The output must be exactly like below.
ZSH_THEME="powerlevel10k/powerlevel10k"
If it's not, you need to fix ~/.zshrc.

Using submit50 in VSCode

I'm doing CS50 AI ( a course from harvard on EdX) and as a result been using submit50 (the command we use to submit assignments) in VSCode via the Windows Subsystem for Linux. Until I updated my IDE to the April update, submit50 used to ask my GitHub username and password in the the terminal itself similar to CS50 IDE.
After the April Update, it redirected me to the GitHub website for authentication and ever since then, I've been getting an error and can't figure out how to fix this.
I've tried re-install VSCode and submit50, upgrading submit50 and none of this has helped.
The Error I'm getting
I deleted VSCode and Code from Appdata to try and delete all data but that did not help.
Git Asking for permission
Any help would be appreciated!
This is due to the new automatic GitHub authentication introduced in VSCode version 1.45.
The temporary fix for this is to disable Git: GitHub Authentication in your VSCode settings either via the settings UI, or by adding the following line to your settings.json:
"git.githubAuthentication": false,
When you try to run submit50 again, a popup prompt for your username and password will appear instead!
Alternatively, you can disable Git: Terminal Authentication in your VSCode settings either via the settings UI, or by adding the following line to your settings.json:
"git.terminalAuthentication": false,
Via this method, you'll get the login prompt for submit50 inside the terminal as per usual.