Intellij IDEA 安装在 Windows 上。使用 maven 构建的 java 应用程序需要本机库(使用 JNI)并在 Ubuntu 上运行。
在 Windows 上使用 maven 和 git 很好。如何让 Intellij IDEA 使用 WSL 中的 JDK,以便我可以创建使用 WSL 的运行/调试配置?
java debugging intellij-idea windows-subsystem-for-linux wsl-2
我对这个行业相当陌生,我不明白如何从我的 win10 机器 SSH 到我安装的 wsl2 ubuntu 20.4
基本上,我遵循了本教程,但我不断收到以下错误:
当我尝试使用公共端口(使用curl ifconfig.me
)进行 SSH 时,出现错误“连接超时”
当我尝试使用私有端口(使用ip route get 1.2.3.4 | awk '{print $7}'
)进行 SSH 时,出现错误“权限被拒绝”
在某些时候,我收到错误“sshd:没有可用的主机密钥 - 正在退出”,所以我遵循了此修复,但随后我收到了前面提到的错误。我应该从/etc/ssh
文件夹中删除任何内容吗?
最终目标是通过 vs-code 进行 ssh 操作,但我想一旦我可以从 powershell 执行此操作,那么与 vs-code 是一样的。
我想创建一个新的 Laravel 8 项目,并且我按照 Windows 上的 docker 和 Sail 的文档进行操作:https ://laravel.com/docs/8.x#getting-started-on-windows
安装完所有内容后,我尝试执行命令来创建项目:
curl -s https://laravel.build/example-app | bash
Run Code Online (Sandbox Code Playgroud)
它询问我的密码。我输入它并按回车键,但什么也没发生。当我按 CTRL+C 时,我可以看到它尝试将我的密码作为命令执行。
我是VIM / NEOVIM世界的新手,所以我可能做错了其他事情,但从文档中它说 Telescope 将忽略文件中注册的所有文件.gitignore
,这肯定是存在的,但它仍然在搜索node_modules
所以这就是我所做的:
cd
进入我的项目文件夹nvim
<leader>ff
node_modules
这些是我用于设置望远镜的插件
" Telescope
Plug 'nvim:solua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Run Code Online (Sandbox Code Playgroud)
然后我直接从文档中重新映射:
" Find files using Telescope command-line sugar.
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
Run Code Online (Sandbox Code Playgroud)
所有这些都在 Ubuntu 的WSL终端中运行。我缺少什么?
我最近安装了 wsl 并code .
在终端中运行时收到此错误:
Updating VS Code Server to version f80445acd5a3dadef24aa209168452a3d97cc326\nRemoving previous installation...\nInstalling VS Code Server for x64 (f80445acd5a3dadef24aa209168452a3d97cc326)\nDownloading: 100%\nFailed\n--2022-03-01 20:19:21-- https://update.code.visualstudio.com/commit:f80445acd5a3dadef24aa209168452a3d97cc326/server-linux-x64/stable\nResolving update.code.visualstudio.com (update.code.visualstudio.com)... 40.64.128.224\nConnecting to update.code.visualstudio.com (update.code.visualstudio.com)|40.64.128.224|:443... connected.\nHTTP request sent, awaiting response... 302 Found\nLocation: https://az764295.vo.msecnd.net/stable/f80445acd5a3dadef24aa209168452a3d97cc326/vscode-server-linux-x64.tar.gz [following]\n--2022-03-01 20:19:25-- https://az764295.vo.msecnd.net/stable/f80445acd5a3dadef24aa209168452a3d97cc326/vscode-server-linux-x64.tar.gz\nResolving az764295.vo.msecnd.net (az764295.vo.msecnd.net)... failed: Temporary failure in name resolution.\nwget: unable to resolve host address \xe2\x80\x98az764295.vo.msecnd.net\xe2\x80\x99\nERROR: Failed to download https://update.code.visualstudio.com/commit:f80445acd5a3dadef24aa209168452a3d97cc326/server-linux-x64/stable to /home/burbanox/.vscode-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326-1646176740.tar.gz\n
Run Code Online (Sandbox Code Playgroud)\n我需要知道如何解决它才能打开 Visual Studio Code
\n在 Windows 上的当前目录中,我有以下脚本文件 simple_script.sh:
#!/bin/bash
echo "hi from simple script"
Run Code Online (Sandbox Code Playgroud)
我希望通过 powershell 命令行在 wsl 上运行此脚本。
使用该wsl
命令,我找不到告诉 wsl 调用脚本代码的方法。
以下命令有效(我认为)
wsl bash -c "echo hi from simple script"
Run Code Online (Sandbox Code Playgroud)
但是,当尝试将脚本内容加载到变量中并运行时,它无法按预期工作:
$simple_script = Get-Content ./simple_script.sh
wsl bash -c $simple_script
Run Code Online (Sandbox Code Playgroud)
失败:
bash: -c: option requires an argument
Run Code Online (Sandbox Code Playgroud)
我尝试了几种变体。Get-Content
与标志一起使用-Raw
似乎会打印字符串中的第一个单词(但不是整个字符串)。不包含“”字符的命令有时似乎有效。但我还没有找到一致的方法。
类似的问题似乎不能直接与 wsl 一起工作,并且似乎不能运行驻留在 Windows 文件系统上的脚本文件。
/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe get: 1: /mnt/c/Program Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe: not found
Run Code Online (Sandbox Code Playgroud)
我发现这个问题,然后每当我从本地 WSL2 环境中使用 GitHub 远程存储库进行 git 活动时,git 都会要求我提供用户名和密码,以便向 GitHub 进行身份验证。
每次都这样做很烦人,然后我搜索并遵循我在互联网上可以找到的几个教程,但一切都让我再次遇到同样的问题,这些教程根本不能解决我的问题。
每个教程都告诉我应该为WSL2环境中的git添加Windows环境中的GCM目录。理论上,它应该可以解决我的问题,但事实并非如此。
git github windows-subsystem-for-linux git-credential-manager wsl-2
我想调试在 WSL2 下运行的 .NET Core 进程,但无法从 Windows 中的 Rider 附加到它。有办法实现这一点吗?
我正在尝试在 wsl 中打开 Visual Studio 代码,但出现以下错误。怎么解决呢?
To use Visual Studio Code with the Windows Subsystem for Linux, please install Visual Studio Code in Windows and uninstall the Linux version in WSL. You can then use the `code` command in a WSL terminal just as you would in a normal command prompt.
Do you want to continue anyway? [y/N] y
To no longer see this prompt, start Visual Studio Code with the environment variable DONT_PROMPT_WSL_INSTALL defined.
/usr/share/code/bin/../code: error while loading shared …
Run Code Online (Sandbox Code Playgroud) 我在 Visual Studio 2022 中创建了一个控制台应用程序,只有两行 WriteLine 和 ReadLine。在 Windows 上调试它时,会打开一个控制台,显示输出并等待输入。但是,如果我将其切换到 WSL 调试,我会在 \xe2\x80\x9cOutput\xe2\x80\x9d 窗口中得到输出,但我没有找到任何方法将任何数据输入到程序的标准输入,从而得到卡在阅读行。有办法做到这一点吗?也许让 Visual Studio 打开控制台窗口,而不是像 Windows 应用程序那样使用 Visual Studio 中的输出窗口?
\nvisual-studio windows-subsystem-for-linux wsl-2 .net-6.0 visual-studio-2022
wsl-2 ×10
windows-subsystem-for-linux ×5
debugging ×2
.net-6.0 ×1
bash ×1
c# ×1
git ×1
github ×1
java ×1
laravel-8 ×1
laravel-sail ×1
neovim ×1
powershell ×1
rider ×1
ssh ×1
ubuntu ×1
windows-10 ×1