Visual studio code не работает терминал
Я пытаюсь вставить GitBash в качестве опции в VS Code. Мои настройки выглядят так:
Однако в последней строке VS Code выдал следующую ошибку:
Я не понимаю, где я ошибся, а вы?
Примечание. "terminal.integrated.shell.windows" устарел с апреля 2021 года.
4 ответа
Я считаю, что Visual Studio Code использует ваши переменные PATH, чтобы определить, какие профили доступны на вашем компьютере. Я предполагаю, что у вас нет местоположения Git Bash в вашем PATH. Но этого должно быть хорошо, поскольку вы указываете свойство path в настройке. Проблема в том, что вы также устанавливаете свойство source . Согласно описанию настройки terminal.integrated.profiles.windows , вы можете установить source или path , но не оба:
Профили Windows, которые будут отображаться при создании нового терминала в раскрывающемся списке терминала. Установите значение null, чтобы исключить их, используйте свойство source , чтобы использовать обнаруженную по умолчанию конфигурацию. Или установите path и необязательно args
Удалите свойство source и посмотрите, решится ли проблема, и вы сможете открыть терминал git bash в Visual Studio Code.
Кроме того, вам может потребоваться перезапустить Visual Studio Code после внесения этих изменений. Это может быть отдельная ошибка, но настройка terminal.integrated.profiles.windows не обнаружит никаких новых профилей, добавленных до перезапуска.
У меня тоже была эта пробема. Удаление строки "исходный код" для git bash исправило это для меня
(Извините, Тимоти Джи, это я пытался ответить на ваше предложение)
VS Code версии 1.57.1.
Добавлен путь к Git, Git \ bin, Git \ cmd в env. Имел профиль «Git Bash» с элементами источника и пути. Удален источник и оставлен только путь. При добавлении defaultProfile в качестве «Git Bash» возникла ошибка «Значение не принято». Перезапуск VS Code не помог.
Смена "Git Bash" на "GitBash" (пробел удален) наконец-то сработал для меня:
Я не уверен, действительно ли проблема в пространстве. Потому что есть профиль "Командная строка" с пробелом в названии и распознается . Чтобы еще раз подтвердить это, изменил «PowerShell» на «Power Shell», и это тоже сработало.
Я не понимаю, какое значение имеет место только в профиле «GitBash».
У меня была аналогичная проблема. Как Тимоти. G указал, что у вас может быть только «источник» или «путь», но не то и другое одновременно. Но также простой перезапуск VS Code активирует вновь созданный профиль.
Вот тот, который я создал, чтобы иметь терминал conda по умолчанию (в Windows)
To start, we'd like to say we're sorry that you're here reading this document instead of having a good time using the Integrated Terminal in Visual Studio Code. The VS Code team works hard to make the terminal experience as seamless as possible but in some cases, there are issues with shell or terminal configurations that the VS Code editor can't work around.
After having worked with hundreds of developers to diagnose their terminal launch failures, the VS Code team has put together this topic with the advice and troubleshooting tips that have helped people in the past. We hope you'll find an answer here for your shell or terminal issue and can get quickly back to work.
Integrated Terminal user guide
If you are new to using the VS Code Integrated Terminal, you can learn more in the Integrated Terminal user guide. There you can read how to configure the terminal, as well as review answers to common questions.
Below are specific troubleshooting steps, if the user guide hasn't helped you diagnose the launch failure. The troubleshooting steps, such as checking your settings and enabling logging, apply to all platforms that support VS Code; macOS, Linux, and Windows.
Note: If you're on Windows, you may want to review the common issues on Windows section first.
Troubleshooting steps
To troubleshoot Integrated Terminal launch failures in Visual Studio Code, follow these steps to diagnose issues:
Check your user settings. Review these terminal.integrated settings that could affect the launch:
- terminal.integrated.shell. - The path of the shell that the terminal uses.
- terminal.integrated.shellArgs. - The command-line arguments when launching the shell process.
- terminal.integrated.cwd - The current working directory (cwd) for the shell process.
- terminal.integrated.env. - Environment variables that will be added to the shell process.
- terminal.integrated.inheritEnv - Whether new shells should inherit their environment from VS Code.
- terminal.integrated.automationShell. - Shell path for automation-related terminal usage like tasks and debug.
- terminal.integrated.splitCwd - Controls the current working directory a split terminal starts with.
- terminal.integrated.windowsEnableConpty - Whether to use ConPTY for Windows terminal process communication.
You can review settings in the Settings editor (File > Preferences > Settings) and search for specific settings by the setting ID.
A quick way to check if you have changed settings that you might not be aware of, is to use the @modified filter in the Settings editor.
Most Integrated Terminal settings will need to be modified directly in your user settings.json JSON file. You can open settings.json via the Edit in settings.json link in the Settings editor or with the Preferences: Open Settings (JSON) command from the Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P ) ).
Test your shell directly. Try running your designated integrated terminal shell outside VS Code from an external terminal or command prompt. Some terminal launch failures may be due to your shell installation and are not specific to VS Code. The exit codes displayed come from the shell and you may be able to diagnose shell issues by searching on the internet for the specific shell and exit code.
Use the most recent version of VS Code. Each VS Code monthly release has many updates and fixes and may include integrated terminal improvements. You can check your VS Code version via Help > About (on macOS Code > About Visual Studio Code). To find the latest version of VS Code, go to the VS Code release notes. You may also want to check that you have installed the latest version of your shell.
Use the most recent version of your shell. If your shell is installed separate from your platform, try installing the latest available version of the shell. The same advice applies if you are on an older build of your operating system. For example, some older versions of Windows 10 did not work well with the VS Code terminal.
Enable trace logging. You can enable trace logging and capture a log when launching the terminal. Logging often reveals what is wrong as all arguments used to create the terminal process/pty are recorded. Bad shell names, arguments, or environment variables can cause the terminal to not launch. Keep this log for later if your problem isn't solved.
Additional troubleshooting steps
If none of these steps helped solve the issue, you can also try:
- Ask about it on Stack Overflow, often launch issues are related to environment setup and not a problem with VS Code.
- If the terminal is being launched from an extension, report the issue to the extension by opening the issue reporter (Help > Report Issue) and set File On = "An Extension"
- If you believe it to be a bug with VS Code, report the issue using the issue reporter (Help >Report Issue). The issue reporter will autofill relevant information, see Creating great terminal issues for what else to include in the report.
- If you're on Windows 10 1809 (build 17763) or below, the issue is related to the legacy "winpty" backend. Upgrading to Windows 1903 (build 18362) will move you onto the new "conpty" backend that is built by Microsoft and could fix your problem.
Exit codes
The exit codes displayed in the terminal launch failure notification are returned from the shell process and are not generated by VS Code. There are many available shells that can be used in the terminal and hundreds of possible exit codes.
Common issues on Windows
Make sure compatibility mode is disabled
When upgrading to Windows 10, some apps may have compatibility mode turned on automatically. When this happens with VS Code, the terminal breaks as it does some low level things to enable the emulation it uses. You can check and disable compatibility mode by right-clicking on the VS Code executable and selecting properties, then uncheck the Run this program in compatibility mode option in the compatibility tab.
The terminal exited with code 1 on Windows 10 (with WSL as the default shell)
This can happen if Windows Subsystem for Linux (WSL) is not set up with a valid default Linux distribution.
Note: 'docker-desktop-data' is not a valid distribution.
- Open PowerShell and enter wslconfig.exe /l to confirm WSL is installed correctly and list the currently available Linux distributions within your system. Confirm a valid distribution has (default) next to it.
- To change the default distribution, enter wslconfig.exe /setdefault "distributionNameAsShownInList"
The terminal not working when running the 32-bit Windows client on 64-bit Windows?
The easy fix for this issue is to use the 64-bit version. If you must use the 32-bit version, you need to use the sysnative path when configuring your shell path instead of System32. Adding this setting should fix the issue:
A native exception occurred
Typically this error occurs due to anti-virus software intercepting and blocking the winpty/conpty components from creating the terminal process. To work around this error, you can exclude the following file from your anti-virus scanning:
Reporting this issue to the Anti-virus team can also help stamp out the issue all together.
Terminal exits with code 3221225786 (or similar)
This can happen when you have legacy console mode enabled in conhost's properties. To change this, open cmd.exe from the start menu, right-click the title bar, go to Properties and under the Options tab, uncheck Use legacy console.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Open with Desktop
- View raw
- Copy raw contents Copy raw contents
Copy raw contents
Copy raw contents
Troubleshoot Terminal launch failures
To start, we'd like to say we're sorry that you're here reading this document instead of having a good time using the Integrated Terminal in Visual Studio Code. The VS Code team works hard to make the terminal experience as seamless as possible but in some cases, there are issues with shell or terminal configurations that the VS Code editor can't work around.
After having worked with hundreds of developers to diagnose their terminal launch failures, the VS Code team has put together this topic with the advice and troubleshooting tips that have helped people in the past. We hope you'll find an answer here for your shell or terminal issue and can get quickly back to work.
Integrated Terminal user guide
If you are new to using the VS Code Integrated Terminal, you can learn more in the Integrated Terminal user guide. There you can read how to configure the terminal, as well as review answers to common questions.
Below are specific troubleshooting steps, if the user guide hasn't helped you diagnose the launch failure. The troubleshooting steps, such as checking your settings and enabling logging, apply to all platforms that support VS Code; macOS, Linux, and Windows.
Note: If you're on Windows, you may want to review the common issues on Windows section first.
To troubleshoot Integrated Terminal launch failures in Visual Studio Code, follow these steps to diagnose issues:
Check your user settings. Review these terminal.integrated settings that could affect the launch:
- terminal.integrated.shell. - The path of the shell that the terminal uses.
- terminal.integrated.shellArgs. - The command-line arguments when launching the shell process.
- terminal.integrated.cwd - The current working directory (cwd) for the shell process.
- terminal.integrated.env. - Environment variables that will be added to the shell process.
- terminal.integrated.inheritEnv - Whether new shells should inherit their environment from VS Code.
- terminal.integrated.automationShell. - Shell path for automation-related terminal usage like tasks and debug.
- terminal.integrated.splitCwd - Controls the current working directory a split terminal starts with.
- terminal.integrated.windowsEnableConpty - Whether to use ConPTY for Windows terminal process communication.
You can review settings in the Settings editor (File > Preferences > Settings) and search for specific settings by the setting ID.
A quick way to check if you have changed settings that you might not be aware of, is to use the @modified filter in the Settings editor.
Most Integrated Terminal settings will need to be modified directly in your user settings.json JSON file. You can open settings.json via the Edit in settings.json link in the Settings editor or with the Preferences: Open Settings (JSON) command from the Command Palette ( kb(workbench.action.showCommands) ).
Test your shell directly. Try running your designated integrated terminal shell outside VS Code from an external terminal or command prompt. Some terminal launch failures may be due to your shell installation and are not specific to VS Code. The exit codes displayed come from the shell and you may be able to diagnose shell issues by searching on the internet for the specific shell and exit code.
Use the most recent version of VS Code. Each VS Code monthly release has many updates and fixes and may include integrated terminal improvements. You can check your VS Code version via Help > About (on macOS Code > About Visual Studio Code). To find the latest version of VS Code, go to the VS Code release notes. You may also want to check that you have installed the latest version of your shell.
Use the most recent version of your shell. If your shell is installed separate from your platform, try installing the latest available version of the shell. The same advice applies if you are on an older build of your operating system. For example, some older versions of Windows 10 did not work well with the VS Code terminal.
Enable trace logging. You can enable trace logging and capture a log when launching the terminal. Logging often reveals what is wrong as all arguments used to create the terminal process/pty are recorded. Bad shell names, arguments, or environment variables can cause the terminal to not launch. Keep this log for later if your problem isn't solved.
Additional troubleshooting steps
If none of these steps helped solve the issue, you can also try:
- Ask about it on Stack Overflow, often launch issues are related to environment setup and not a problem with VS Code.
- If the terminal is being launched from an extension, report the issue to the extension by opening the issue reporter (Help > Report Issue) and set File On = "An Extension"
- If you believe it to be a bug with VS Code, report the issue using the issue reporter (Help >Report Issue). The issue reporter will autofill relevant information, see Creating great terminal issues for what else to include in the report.
- If you're on Windows 10 1809 (build 17763) or below, the issue is related to the legacy "winpty" backend. Upgrading to Windows 1903 (build 18362) will move you onto the new "conpty" backend that is built by Microsoft and could fix your problem.
The exit codes displayed in the terminal launch failure notification are returned from the shell process and are not generated by VS Code. There are many available shells that can be used in the terminal and hundreds of possible exit codes.
Common issues on Windows
Make sure compatibility mode is disabled
When upgrading to Windows 10, some apps may have compatibility mode turned on automatically. When this happens with VS Code, the terminal breaks as it does some low level things to enable the emulation it uses. You can check and disable compatibility mode by right-clicking on the VS Code executable and selecting properties, then uncheck the Run this program in compatibility mode option in the compatibility tab.
The terminal exited with code 1 on Windows 10 (with WSL as the default shell)
This can happen if Windows Subsystem for Linux (WSL) is not set up with a valid default Linux distribution.
Note: 'docker-desktop-data' is not a valid distribution.
- Open PowerShell and enter wslconfig.exe /l to confirm WSL is installed correctly and list the currently available Linux distributions within your system. Confirm a valid distribution has (default) next to it.
- To change the default distribution, enter wslconfig.exe /setdefault "distributionNameAsShownInList"
The terminal not working when running the 32-bit Windows client on 64-bit Windows?
The easy fix for this issue is to use the 64-bit version. If you must use the 32-bit version, you need to use the sysnative path when configuring your shell path instead of System32. Adding this setting should fix the issue:
A native exception occurred
Typically this error occurs due to anti-virus software intercepting and blocking the winpty/conpty components from creating the terminal process. To work around this error, you can exclude the following file from your anti-virus scanning:
Reporting this issue to the Anti-virus team can also help stamp out the issue all together.
Terminal exits with code 3221225786 (or similar)
This can happen when you have legacy console mode enabled in conhost's properties. To change this, open cmd.exe from the start menu, right-click the title bar, go to Properties and under the Options tab, uncheck Use legacy console.
I tried to compile a program but terminal is not opening.
this guy has same error but pop-up is different link
below is the JSON file of my vscode
see this link for full error description, i wrote code and compiled and got error message. link
@Piyush Whatever was showing i mentioned bro,i can't add the picture so posting a link of picture which has same error as mine. link
11 Answers 11
This setting breaks my terminal window (because powershell is blocked due company admin):
Afterwards I could not open the terminal again.
Restore CMD as default
Change the path in the VS Code settings:
- open Preferences > Settings (CTRL+,)
- search for terminal.integrated.shell.windows
- (other OS replace windwos with linux or osx )
- click Edit in settings.json
- set CMD path "terminal.integrated.shell.windows": "C:\\windows\\System32\\cmd.exe",
Now the terminal should open again. This is not a fix to get Powershell working in VS Code, just a guide to restore the terminal window.
UPDATE Sep 2021 (Additional Setting)
Search for terminal.integrated.defaultProfile.windows and set a default (for me Command Prompt)
It appears that you're trying to get Powershell on VS Code integrated terminal.
Lemme share the process of how I did it.
- Open VS-Code
- Go to File > Preferences > Settings
- Type "Terminal" in the search bar
- Under features > click on "terminal"
- Scroll down until you find a section like this and make sure the option is empty (this sets a default starting directory):
Terminal › Integrated: Cwd An explicit start path where the terminal will be launched, this is used as the current working directory (cwd) for the shell process. This may be particularly useful in workspace settings if the root directory is not a convenient cwd.
- Scroll down until you find this other option
Terminal › Integrated › Shell: Windows The path of the shell that the terminal uses on Windows (default:
Click on edit settings.json
Paste your terminal absolute path within the brackets (make sure you escape the slashes) that's the reason of why I'm using double
Я использую код Visual Studio, так как он был в бета-версии, и одна из функций, которые мне нравятся больше всего, - это встроенный терминал для использования Angular CLI в приложении. У меня все работало нормально, так как у меня был ноутбук, но я переустановил Windows 10 после перерыва на Рождество и, очевидно, в результате пришлось переустановить код Visual Studio.
С тех пор у меня были проблемы с Терминалом, он пуст, пока вы не нажмете return, после чего вы увидите путь, но не обычное уведомление об авторских правах, которое вы должны получить из командной строки Windows.
Перед тем как вернуться назад:
После нажатия вернуться:
И это то, что я ожидал непосредственно от командной строки Windows 10:
До сих пор я пробовал следующее:
- Обычная винда закрывается / перезагружается
- Переустановка VS Code (даже изменена с обычного на инсайдера)
- Изменение оболочки командной строки по умолчанию с CMD на Powershell и обратно
- Добавление новой оболочки командной строки
Есть что-нибудь еще, что я могу попробовать? Кто-нибудь еще сталкивался с такой же проблемой?
После некоторых исследований я обнаружил, что это ошибка в VS Code в приложении, которое они используют для интеграции оболочки. Похоже, Android Studio тоже имеет такую же проблему. Более подробно о том, как / когда / что и т. Д., Вы можете прочитать здесь:
Это было исправлено в выпуске инсайдеров, который мне выпал сегодня (01.08.2017), не уверен, когда он будет выпущен в общем выпуске (если не в январе, то я бы предположил, что он может появиться в феврале, если больше не будет вопросы).
Так что для всех, кто еще сталкивается с этой проблемой, обновите до последней версии VS Code. Если вы справились, но проблема все еще не устранена, вы можете проверить и сообщить о проблеме здесь:
Вот исправление для кода в Ubuntu-18.04: проблема не появляется при открытии через терминал. Перейдите к настройкам в левом нижнем углу и найдите «Terminal.integrated.inheritEnv». Установите флажок для этого в разделе пользователя, чтобы терминал наследовал среду пользователя. Выполнено!!
Мое решение для VSCode 1.39.2 с Ubuntu было:
Файл -> Настройки -> Настройки -> Функции -> Терминал -> Наследовать Env
Я испытывал ту же проблему. Я обновил до последней версии VSCode 1.42.1, но это не помогло. Кажется, что проблема связана с Powershell 2.0, поэтому я удалил его:
Панель управления-> Программы и компоненты-> Включить или выключить функции Windows-> Windows PowerShell 2.0 (отключить его).
Это решило проблему для меня.
У меня та же проблема с PowerShell даже после установки обновления 1.32.1. Я исправил это, перейдя к параметрам PowerShell и выбрав опцию «Использовать устаревшую консоль», и теперь он работает как надо, и я думаю, что он должен работать и с cmd.
Измените terminal.integrated.rendererType обратно на canvas в настройках VS Code, и проблема не появится снова.
У меня та же проблема с PowerShell, Gitbash и т. Д. С версией кода 1.36.0. Смотрите информацию о версии 1
Я мог бы очистить проблему с помощью следующих шагов:
Откройте PowerShell в режиме администратора. 2
В нижней части элемента Legacy console установлен флажок, который установлен по умолчанию.
Отмените выбор этой опции, затем Сохранить. 3
Код перезагрузки Наконец, консоль выглядит как положено. 4
В окне терминала нажмите Ctrl + c и нажмите enter
Хотя это и не постоянное решение, а быстрое решение, чтобы дать соку течь, пока вы работаете с VSCode
У меня была такая же проблема в коде Visual Studio 1.41.1 в Ubuntu 18.04, я решил ее, отредактировав файл settings.json, выполнив настройки и выполнив поиск 'Inherit Env', открыв Edit в settings.json и изменив
"terminal.integrated.inheritEnv": true, скриншот предоставлен по ссылке ниже
Код VS вызвал диалоговое окно в правом нижнем углу, рекомендовав мне переключить параметр RenderType на dom , потому что он чувствовал, что работает медленно. Затем выданный бланк-терминал исчез. Моей средой был vm Ubuntu 16.04, работающий на win10.
Решением для меня было удалить пользовательский режим и вместо этого установить системный режим. Это то, что сказал Дженуэль Ганавед, и я не знаю, почему этот пост был отклонен. Это решает проблему в моем случае.
У меня была такая же проблема при работе над CMD в моем VSCode. Я исправил это, перейдя в меню терминала в VS Code и выбрал New Terminal. И новый терминал CMD открылся, и он работает просто отлично.
Читайте также:
- Пояснительная записка к комплекту документов по запросу в рамках федерального закона 115 фз в ворде
- Ms powerpoint что нельзя добавить
- Программа желтый смайлик для удаления рекламы из apk на андроид
- Program files common files apple mobile device support drivers нет папки
- Как разблокировать расширение в опере