Ubuntu安装vscode web版 code-server

2024-11-23 Frank 工具

下载

https://github.com/coder/code-server/releases/tag/v4.95.3
下载 code-server_4.95.3_amd64.deb

安装

dpkg -i code-server_4.90.2_amd64.deb

错误

错误:code-server typeerror: cannot read property ‘split’ of undefined
解决:

cd /usr/lib/code-server
npm i --unsafe-perm

错误:找不到配置文件 /root/..local/share/code-server/User/settings.json
解决:touch .local/share/code-server/User/settings.json

错误:The workbench failed to connect to the server (Error: WebSocket close with status code 1006) Gitlab Web IDE
解决:websocket连接错误一般是nginx 代理问题

#PROXY-START/

location ^~ /
{
    proxy_pass http://127.0.0.1:8080;
    #proxy_set_header Host 127.0.0.1;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    #proxy_set_header Connection $connection_upgrade;
    proxy_http_version 1.1;

    proxy_set_header Host $http_host;
    #proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection upgrade;
    proxy_set_header Accept-Encoding gzip;
    # proxy_hide_header Upgrade;

    add_header X-Cache $upstream_cache_status;
    #Set Nginx Cache

    set $static_file2kqaDKM8 0;
    if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
    {
        set $static_file2kqaDKM8 1;
        expires 1m;
    }
    if ( $static_file2kqaDKM8 = 0 )
    {
        add_header Cache-Control no-cache;
    }
}
#PROXY-END/

参考

发表评论 登录

Top