microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

yarn install fails bind proxy again #11511

Open wangzhankun opened 1 year ago

wangzhankun commented 1 year ago

Same error as vscode-cpptools/issues/10631, it's said that the problem has been solved by Update vscode/dts #11047, but the bug still exists.

Environment

Bug Summary and Steps to Reproduce

Bug Summary:

Steps to reproduce:

git clone https://github.com/Microsoft/vscode-cpptools.git
cd vscode-cpptools/Extension
export https_proxy=http://my_proxy:port
yarn install --proxy http://my_proxy:port

Expected behavior: install success

Configuration and Logs

yarn install --proxy=http://127.0.0.1:7890
yarn install v1.22.19
[1/5] Validating package.json...
warning cpptools@1.17.5-main: The engine "vscode" appears to be invalid.
[2/5] Resolving packages...
success Already up-to-date.
$ npx vscode-dts dev && npx vscode-dts main
Downloading vscode.proposed.terminalDataWriteEvent.d.ts
To:   /home/wang/Documents/vmm/vscode-cpptools/Extension/vscode.proposed.terminalDataWriteEvent.d.ts
From: https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts
Read more about proposed API at: https://code.visualstudio.com/api/advanced-topics/using-proposed-api
node:events:492
      throw er; // Unhandled 'error' event
      ^

AggregateError
    at internalConnectMultiple (node:net:1114:18)
    at afterConnectMultiple (node:net:1667:5)
Emitted 'error' event on ClientRequest instance at:
    at TLSSocket.socketErrorListener (node:_http_client:495:9)
    at TLSSocket.emit (node:events:514:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'ECONNREFUSED',
  [errors]: [
    Error: connect ECONNREFUSED 0.0.0.0:443
        at createConnectionError (node:net:1634:14)
        at afterConnectMultiple (node:net:1664:40) {
      errno: -111,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '0.0.0.0',
      port: 443
    },
    Error: connect ECONNREFUSED :::443
        at createConnectionError (node:net:1634:14)
        at afterConnectMultiple (node:net:1664:40) {
      errno: -111,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '::',
      port: 443
    }
  ]
}
### Tasks
- [ ] https://github.com/microsoft/vscode-cpptools/issues/10631
- [ ] https://github.com/microsoft/vscode-dts/issues/22
sean-mcmanus commented 1 year ago

@wangzhankun Do you know when approximately this was last working? Did the original fix work and then something recently broke it?

StidOfficial commented 4 weeks ago

You still use an old version of vscode-dts :

# npx vscode-dts
Need to install the following packages:
vscode-dts@0.3.3
Ok to proceed? (y) 

https://registry.npmjs.org/vscode-dts https://registry.npmjs.org/@vscode/dts

How to fix it :

diff --git a/Extension/package.json b/Extension/package.json
index 64b046ed..6c826da6 100644
--- a/Extension/package.json
+++ b/Extension/package.json
@@ -6479,7 +6479,7 @@
         "translations-generate": "set NODE_OPTIONS=--no-experimental-fetch && gulp translations-generate",
         "translations-import": "gulp translations-import",
         "import-edge-strings": "ts-node -T ./.scripts/import_edge_strings.ts",
-        "prep:dts": "yarn verify dts --quiet || (npx vscode-dts dev && npx vscode-dts main)",
+        "prep:dts": "yarn verify dts --quiet || (npx @vscode/dts dev && npx vscode/dts main)",
         "build": "yarn prep:dts && echo [Building TypeScript code] && tsc --build tsconfig.json"
     },
     "devDependencies": {
sean-mcmanus commented 4 weeks ago

@StidOfficial From what I can tell, we're using vscode-dts version 0.4.1. That's what it shows in our yarn.lock file https://github.com/microsoft/vscode-cpptools/blob/main/Extension/yarn.lock#L589

StidOfficial commented 4 weeks ago

Has you can see from npm registry, the latest version is :

Despite the @vscode/dts in the yarn.lock, @vscode/dts is diffrent from vscode-dts. So you are actually using an old version of vscode-dts.

There a mistake in the https://github.com/microsoft/vscode-dts/blob/main/README.md?plain=1#L8, he has not been updated since 3 years.

You can try :

...
/ # npx vscode-dts
Need to install the following packages:
vscode-dts@0.3.3
Ok to proceed? (y) 
...
# npx @vscode/dts
Need to install the following packages:
@vscode/dts@0.4.1
Ok to proceed? (y) 

From vscode-cpptools repo :

apk add git yarn npm
git clone https://github.com/microsoft/vscode-cpptools.git
cd vscode-cpptools/Extension
yarn install
yarn compile

Result :

$ docker run --rm -it alpine sh
/ # apk add git yarn npm
fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/community/x86_64/APKINDEX.tar.gz
(1/22) Installing ca-certificates (20240705-r0)
(2/22) Installing brotli-libs (1.1.0-r2)
(3/22) Installing c-ares (1.33.1-r0)
(4/22) Installing libunistring (1.2-r0)
(5/22) Installing libidn2 (2.3.7-r0)
(6/22) Installing nghttp2-libs (1.62.1-r0)
(7/22) Installing libpsl (0.21.5-r1)
(8/22) Installing zstd-libs (1.5.6-r0)
(9/22) Installing libcurl (8.9.1-r2)
(10/22) Installing libexpat (2.6.3-r0)
(11/22) Installing pcre2 (10.43-r0)
(12/22) Installing git (2.45.2-r0)
(13/22) Installing git-init-template (2.45.2-r0)
(14/22) Installing libgcc (13.2.1_git20240309-r0)
(15/22) Installing libstdc++ (13.2.1_git20240309-r0)
(16/22) Installing ada-libs (2.7.8-r0)
(17/22) Installing libbase64 (0.5.2-r0)
(18/22) Installing icu-data-en (74.2-r0)
Executing icu-data-en-74.2-r0.post-install
*
* If you need ICU with non-English locales and legacy charset support, install
* package icu-data-full.
*
(19/22) Installing icu-libs (74.2-r0)
(20/22) Installing nodejs (20.15.1-r0)
(21/22) Installing npm (10.8.0-r0)
(22/22) Installing yarn (1.22.22-r0)
Executing busybox-1.36.1-r29.trigger
Executing ca-certificates-20240705-r0.trigger
OK: 89 MiB in 36 packages
/ # git clone https://github.com/microsoft/vscode-cpptools.git
Cloning into 'vscode-cpptools'...
remote: Enumerating objects: 31276, done.
remote: Counting objects: 100% (161/161), done.
remote: Compressing objects: 100% (97/97), done.
remote: Total 31276 (delta 78), reused 116 (delta 50), pack-reused 31115 (from 1)
Receiving objects: 100% (31276/31276), 54.03 MiB | 3.37 MiB/s, done.
Resolving deltas: 100% (23509/23509), done.
/ # cd vscode-cpptools/Extension
/vscode-cpptools/Extension # yarn install
yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "@vscode/extension-telemetry > @microsoft/applicationinsights-web-basic@3.3.1" has unmet peer dependency "tslib@*".
warning "@vscode/extension-telemetry > @microsoft/1ds-core-js > @microsoft/applicationinsights-core-js@3.3.1" has unmet peer dependency "tslib@*".
warning "@vscode/extension-telemetry > @microsoft/applicationinsights-web-basic > @microsoft/applicationinsights-channel-js@3.3.1" has unmet peer dependency "tslib@*".
warning "@vscode/extension-telemetry > @microsoft/applicationinsights-web-basic > @microsoft/applicationinsights-common@3.3.1" has unmet peer dependency "tslib@*".
[4/4] Building fresh packages...
Done in 18.71s.
/vscode-cpptools/Extension # yarn compile
[1/4] Resolving packages...
success Already up-to-date.
Need to install the following packages:
vscode-dts@0.3.3
Ok to proceed? (y)