Tag Archives: vscode

[Solved] Win 10 VS Code Connect to the container of the server error: Cannot connect to the Docker daemon at … Is the docker daemon running

Background

After solving the installation of docker desktop above, I continue to operate according to the instructions of vs code plug-in remote container, in order to connect and edit the files in the container on the remote server (Linux) on the PC (Windows).

After everything is completed, the container is connected, but an error is reported. The log content is cannot connect to the docker daemon at http://docker.example.com. Is the docker daemon running. However, the docker desktop of my PC has already started docker, no problem.

After searching, I found that my account on the server is not in the docker group, that is, I need sudo to execute the docker instruction every time. The solution is to add my account to the docker group.

Solution:

Add according to the instructions on the official website, and then everything goes well and the problem is solved. The following code is a simple version, you can go directly to the official website.

cat /etc/group | grep docker # Print group information and filter with grep to view onlydocker
# If there are no results, run the following command to create a new docker group 
sudo groupadd docker 
# If the cat command yields results, then instead of creating a new group, just run the following command
sudo usermod -aG docker $USER # where $USER is replaced by your account name
newgrp docker # In Linux environment, make the group update take effect; other environments see the official website link
docker run hello-world # Check if docker can be executed without sudo

Post-installation steps for Linux | Docker Documentation

 

To access files in a remote server’s container with vs Code
1. Install VS code on PC
2. Connect to the server remotely: Find the Remote-SSH plug-in in the extension of VS code, configure the ssh file after installation, and connect to the server successfully
3. Find Remote-Container in the extension of VS code, install it, and then install docker and WSL2 software according to the extension’s introduction ( the link where the problem occurred above )
4. Connect to the server according to the introduction of Remote-Container (the problematic link in this article)

Vscode save Vue format eslint check error [How to Solve]

1. Problem description

When writing items with Vue, the eslint syntax check was turned on as usual, but various errors, single and double quotation marks and function spaces were found after formatting and saving with vscode. Because the formatting plug-in of vscode itself does not match eslint. Therefore, some configurations need to be modified to achieve the effect of configuration. There are two ways to modify.

2. Solution 1

Since the vsdoe formatting does not match eslint, we will modify the rules of vscode. Create a file .Pretierrc under the current project and modify relevant configuration items. Here, we only modify single and double quotation marks and semicolons.

 {
   "semi": true,
   "singleQuote": true
 }

3. Solution 2

Modify the style location where you save Vue formats:

3.1 open configuration item

3.2 find the corresponding configuration item and modify the corresponding value

"[vue]": {
        //"editor.defaultFormatter": "esbenp.prettier-vscode" //before fixing,
         "editor.defaultFormatter": "octref.vetur" // Use vetur formatting rules, after modification
    },

3.3 setting vetur rules

"vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "wrap_attributes": "force-aligned" //Attribute forced line alignment
         },
         "prettier": {
             "semi": true, // keep the semicolon
             "singleQuote": true, // true uses single quotes
        },
    },

VScode import numpy Error: DLL load failed [How to Solve]

vscode & Anaconda import numpy failed: DLL load failed

Phenomenon:
in Anaconda prompt, import numpy is normal
in vscode, import numpy reports an error: DLL load failed

Error reason:
shell opening failed, resulting in CONDA activate failure. There is no environment, and naturally there is no numpy

Solution:
open the vscodesettings.json file

(type)               CTRL + SHIFT + P
(search for:)        open settings
(click:)             Preferences: Open Settings (JSON)

Add in settings.json:

	"terminal.integrated.profiles.windows":{
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash"
        }
    },
    "terminal.integrated.defaultProfile.windows":"Command Prompt" 

In addition, I also refer to another blog. You need to configure the environment variable
and put the following contents into this computer -> Attribute -> Advanced system settings -> Environment variable -> Path path:

D:\anaconda
D:\anaconda\Scripts
D:\anaconda\Library\bin
D:\anaconda\Library\user\bin
D:\anaconda\Library\mingw-w64\bin

[Solved] Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest FAILED和cannot install, GOBIN must be an ab

When configuring the go environment with vscode

Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest FAILED
"stderr": "cannot install, GOBIN must be an absolute path\n" // Prompt to set absolute path

Go components can be installed here, but go.exe installation in Bin cannot be found

We enter go env to view the environment configuration

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=D:\Program Files\Go\bin  // Here is the path used to install the go component
set GOCACHE=C:\Users\44305\AppData\Local\go-build
set GOENV=C:\Users\44305\AppData\Roaming\go\env  // --------------------------------这里是env文件存放的位置
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\44305\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\44305\go
set GOPRIVATE=
set GOPROXY=https://goproxy.io,direct
set GOROOT=D:\Program Files\Go // ---------------Here is the location of the go installation
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17.1
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\44305\AppData\Local\Temp\go-build352704544=/tmp/go-build -gno-record-gcc-switches

Use the command line to find that the settings still do not work. Finally, modify the file directly
1) the first step is to find the env file
set goenv = C:\users\44305\appdata\roaming\go\env// ——————————————- here is the location where the env file is stored

2) The second step is to open it with a notebook

3) the third step is to set the path here to the bin file in the following directory
set goroot = D:\program files\go// ——————– here is the location where go is installed

Finally, close vscode and then open it to install successfully

Tools environment: GOPATH=C:\Users\44305\go, GOBIN=D:\Program Files\Go\bin
Installing 8 tools at the configured GOBIN: D:\Program Files\Go\bin in module mode.
  go-outline
  gotests
  gomodifytags
  impl
  goplay
  dlv
  staticcheck
  gopls

Installing github.com/ramya-rao-a/go-outline@latest (D:\Program Files\Go\bin\go-outline.exe) SUCCEEDED
Installing github.com/cweill/gotests/gotests@latest (D:\Program Files\Go\bin\gotests.exe) SUCCEEDED
Installing github.com/fatih/gomodifytags@latest (D:\Program Files\Go\bin\gomodifytags.exe) SUCCEEDED
Installing github.com/josharian/impl@latest (D:\Program Files\Go\bin\impl.exe) SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay@latest (D:\Program Files\Go\bin\goplay.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv@latest (D:\Program Files\Go\bin\dlv.exe) SUCCEEDED
Installing honnef.co/go/tools/cmd/staticcheck@latest (D:\Program Files\Go\bin\staticcheck.exe) SUCCEEDED
Installing golang.org/x/tools/gopls@latest (D:\Program Files\Go\bin\gopls.exe) SUCCEEDED

All tools successfully installed. You are ready to Go. :)

C++ Error: Invoking “make -j2 -l2“ failed [How to Solve]

Note that this prompt is not the problem, that is, the error is not invoking “make – J2 – L2”, it just indicates that you use dual threaded computing, just like the dual core of a computer. Similarly, “- J4 – L4” and “- J8 – L8” will appear. As shown in the figure above, the problem is that I missed a semicolon when writing C + + code;

Front end Vue project operation error module build failed

Scenario Description: when a Vue project of someone else is running on vscode, the download dependency process is normal, and the run dev reports an error. The information is as follows
in many cases, this error is because the node version required for project operation is inconsistent with your local node version. Just switch back to the normal version

error: expected ‘;‘ at end of member declaration and expected ‘)‘ before ‘&‘ toke Errors

error: expected ‘;’ at end of member declaration
error: expected ‘)’ before ‘&’ Token
error reporting

When developing c + + in Linux environment, the following compilation errors or other inexplicable errors occur while ensuring that there are no errors in the code

	error: expected ';' at end of member declaration
	error: expected ‘)’ before ‘&’ toke

Solution:
check whether the header file contains circularly. For example, a.cpp contains B.H, b.cpp contains C.H, and c.cpp contains A.H to form a ring. In this case, an error will be reported.

[Solved] VScode sftp Code synchronizate Error: Error: No such file

Cause

After the extension is successfully installed, the file upload prompt error: no such file
but the code has actually been uploaded successfully**

Solution:

Open ~ /.Vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2streams/lib/sftp.js

search

options.emitClose= false;

Add under each search term

options.autoDestroy = false;

Remember to restart vscode for the changes to take effect.

Code screenshot

VS2013 error RC2108: expected numerical dialog constant

When viewing the. RC resource file, I don’t know what’s going on. After turning it off and opening it in the resource view, this error will be reported.

I don’t remember moving anything in the. RC file. It just can’t be opened anyway

It is said on the Internet that if the cursor is positioned to the error and the XXX code is added, but if my cursor is positioned to the first line, this method is invalid
https://blog.csdn.net/liuyi1207164339/article/details/47131833

Solution: copy from the old. RC file, delete all the. RC file and replace it with the old. RC file. This should be a bug in vs2013.

[Solved] Vscode Connect to the remote server error: permission denied (public key)

Background

The purpose is to edit the intranet server code locally

However, the springboard machine of the company’s server needs to log in with a key. In addition, there is a dynamic password + personal password. It has not been configured directly with vscode

The termius implementation is borrowed here

How to Solve:

    1. ensure that termius has logged in to the intranet server through the key dynamic password. Use the port forwarding function provided by termius to connect the local XX port to the YY port of the intranet server. Note that the intranet server port here depends on the personal opening. Configure the local ~ /. SSH/config file. For example, the content is as follows
Host local
    HostName 127.0.0.1
    Port xx port
    User Your own username for logging into the server
      1. put a copy of the public key given to you by the company in ~ /.SSH/ and pay attention to these key permissions. Generally, the key is only open to individuals, otherwise an error is reported. For example, permission denied (public key), Chmod 600 ~ /.SSH/* can be executed to change the key files of local and remote servers to only allow individuals to read and write, and the file can be modified locally directly through vscode connection.