microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.42k stars 28.62k forks source link

Failed to compile the git master version of vscode on Ubuntu 20.04. #124467

Closed hongyi-zhao closed 2 years ago

hongyi-zhao commented 3 years ago

On Ubuntu 20.04, I try to compile the git master version of vscode with the following steps:

$ sudo apt-get install build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev python-is-python3
$ sudo apt-get install fakeroot rpm

$ sudo npm install --global yarn

$ pyenv shell datasci
#https://stackoverflow.com/questions/40025591/the-gyp-0-1-distribution-was-not-found
$ pip install git+https://chromium.googlesource.com/external/gyp

# Clone the source code:
$ git clone https://github.com/microsoft/vscode.git microsoft/vscode.git
$ cd microsoft/vscode.git
$ npm install --save-dev vscode-gulp-watch esbuild jsonc-parser parse-semver katex performance
# Compile vscode with the following command:
$ yarn watch
yarn run v1.22.10
$ npm-run-all -lp watch-client watch-extensions
[watch-client    ] $ node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js watch-client
[watch-extensions] $ node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js watch-extensions watch-extension-media
[watch-client    ] [23:20:35] Using gulpfile ~/Public/repo/github.com/microsoft/vscode.git/gulpfile.js
[watch-client    ] [23:20:35] Starting 'watch-client'...
[watch-client    ] [23:20:35] Starting clean-out ...
[watch-extensions] [23:20:35] 
[watch-client    ] [23:20:35] Finished clean-out after 5 ms
[watch-client    ] [23:20:35] Starting watch-client ...
[watch-extensions] Using gulpfile ~/Public/repo/github.com/microsoft/vscode.git/gulpfile.js
[watch-extensions] [23:20:35] Starting 'watch-extensions'...
[watch-extensions] [23:20:35] Starting 'watch-extension-media'...
[watch-extensions] [23:20:35] Starting clean-extension-configuration-editing-build ...
[watch-extensions] [23:20:35] Starting clean-extension-configuration-editing ...
[watch-extensions] [23:20:35] Starting clean-extension-css-language-features-client ...
[watch-extensions] [23:20:35] Starting clean-extension-css-language-features-server ...
[watch-extensions] [23:20:35] Starting clean-extension-debug-auto-launch ...
[watch-extensions] [23:20:35] Starting clean-extension-debug-server-ready ...
[watch-extensions] [23:20:35] Starting clean-extension-emmet ...
[watch-extensions] [23:20:35] Starting clean-extension-extension-editing ...
[watch-extensions] [23:20:35] Starting clean-extension-git ...
[watch-extensions] [23:20:35] Starting clean-extension-github-authentication ...
[watch-extensions] [23:20:35] Starting clean-extension-github ...
[watch-extensions] [23:20:35] Starting clean-extension-grunt ...
[watch-extensions] [23:20:35] Starting clean-extension-gulp ...
[watch-extensions] [23:20:35] Starting clean-extension-html-language-features-client ...
[watch-extensions] [23:20:35] Starting clean-extension-html-language-features-server ...
[watch-extensions] [23:20:35] Starting clean-extension-image-preview ...
[watch-extensions] [23:20:35] Starting clean-extension-jake ...
[watch-extensions] [23:20:35] Starting clean-extension-json-language-features-client ...
[watch-extensions] [23:20:35] Starting clean-extension-json-language-features-server ...
[watch-extensions] [23:20:35] Starting clean-extension-markdown-language-features-preview-src ...
[watch-extensions] [23:20:35] Starting clean-extension-markdown-language-features ...
[watch-extensions] [23:20:35] Starting clean-extension-merge-conflict ...
[watch-extensions] [23:20:35] Starting clean-extension-microsoft-authentication ...
[watch-extensions] [23:20:35] Starting clean-extension-npm ...
[watch-extensions] [23:20:35] Starting clean-extension-php-language-features ...
[watch-extensions] [23:20:35] Starting clean-extension-search-result ...
[watch-extensions] [23:20:35] Starting clean-extension-simple-browser ...
[watch-extensions] [23:20:35] Starting clean-extension-testing-editor-contributions ...
[watch-extensions] [23:20:35] Starting clean-extension-typescript-language-features-test-workspace ...
[watch-extensions] [23:20:35] Starting clean-extension-typescript-language-features ...
[watch-extensions] [23:20:35] Starting clean-extension-vscode-api-tests ...
[watch-extensions] [23:20:35] Starting clean-extension-vscode-colorize-tests ...
[watch-extensions] [23:20:35] Starting clean-extension-vscode-custom-editor-tests ...
[watch-extensions] [23:20:35] Starting clean-extension-vscode-notebook-tests ...
[watch-extensions] [23:20:35] Starting clean-extension-vscode-test-resolver ...
[watch-extensions] [23:20:35] Finished clean-extension-configuration-editing after 602 ms
[watch-extensions] [23:20:35] Starting watch-extension:configuration-editing ...
[watch-extensions] [23:20:36] Starting compilation extensions...
[watch-extensions] [23:20:36] Finished clean-extension-css-language-features-client after 1326 ms
[watch-extensions] [23:20:36] Starting watch-extension:css-language-features-client ...
[watch-extensions] [23:20:36] Finished clean-extension-css-language-features-server after 1335 ms
[watch-extensions] [23:20:36] Starting watch-extension:css-language-features-server ...
[watch-extensions] [23:20:36] Finished clean-extension-debug-auto-launch after 1345 ms
[watch-extensions] [23:20:36] Starting watch-extension:debug-auto-launch ...
[watch-extensions] [23:20:36] Finished clean-extension-debug-server-ready after 1352 ms
[watch-extensions] [23:20:36] Starting watch-extension:debug-server-ready ...
[watch-extensions] [23:20:36] Finished clean-extension-emmet after 1358 ms
[watch-extensions] [23:20:36] Starting watch-extension:emmet ...
[watch-extensions] [23:20:36] Finished clean-extension-extension-editing after 1382 ms
[watch-extensions] [23:20:36] Starting watch-extension:extension-editing ...
[watch-extensions] [23:20:36] Finished clean-extension-git after 1389 ms
[watch-extensions] [23:20:36] Starting watch-extension:git ...
[watch-extensions] [23:20:36] Finished clean-extension-github-authentication after 1411 ms
[watch-extensions] [23:20:36] Starting watch-extension:github-authentication ...
[watch-extensions] [23:20:36] Finished clean-extension-github after 1418 ms
[watch-extensions] [23:20:36] Starting watch-extension:github ...
[watch-extensions] [23:20:36] Finished clean-extension-grunt after 1425 ms
[watch-extensions] [23:20:36] Starting watch-extension:grunt ...
[watch-extensions] [23:20:36] Finished clean-extension-gulp after 1430 ms
[watch-extensions] [23:20:36] Starting watch-extension:gulp ...
[watch-extensions] [23:20:36] Finished clean-extension-html-language-features-client after 1436 ms
[watch-extensions] [23:20:36] Starting watch-extension:html-language-features-client ...
[watch-extensions] [23:20:36] Finished clean-extension-html-language-features-server after 1445 ms
[watch-extensions] [23:20:36] Starting watch-extension:html-language-features-server ...
[watch-extensions] [23:20:36] Finished clean-extension-image-preview after 1461 ms
[watch-extensions] [23:20:36] Starting watch-extension:image-preview ...
[watch-extensions] [23:20:36] Finished clean-extension-jake after 1468 ms
[watch-extensions] [23:20:36] Starting watch-extension:jake ...
[watch-extensions] [23:20:36] Finished clean-extension-json-language-features-client after 1474 ms
[watch-extensions] [23:20:36] Starting watch-extension:json-language-features-client ...
[watch-extensions] [23:20:36] Finished clean-extension-json-language-features-server after 1480 ms
[watch-extensions] [23:20:36] Starting watch-extension:json-language-features-server ...
[watch-extensions] [23:20:36] Finished clean-extension-markdown-language-features after 1487 ms
[watch-extensions] [23:20:36] Starting watch-extension:markdown-language-features ...
[watch-extensions] [23:20:36] Finished clean-extension-merge-conflict after 1504 ms
[watch-extensions] [23:20:36] Starting watch-extension:merge-conflict ...
[watch-extensions] [23:20:36] Finished clean-extension-microsoft-authentication after 1519 ms
[watch-extensions] [23:20:36] Starting watch-extension:microsoft-authentication ...
[watch-extensions] [23:20:36] Finished clean-extension-npm after 1526 ms
[watch-extensions] [23:20:36] Starting watch-extension:npm ...
[watch-extensions] [23:20:36] Finished clean-extension-php-language-features after 1532 ms
[watch-extensions] [23:20:36] Starting watch-extension:php-language-features ...
[watch-extensions] [23:20:36] Finished clean-extension-search-result after 1543 ms
[watch-extensions] [23:20:36] Starting watch-extension:search-result ...
[watch-extensions] [23:20:36] Finished clean-extension-simple-browser after 1549 ms
[watch-extensions] [23:20:36] Starting watch-extension:simple-browser ...
[watch-extensions] [23:20:36] Finished clean-extension-testing-editor-contributions after 1555 ms
[watch-extensions] [23:20:36] Starting watch-extension:testing-editor-contributions ...
[watch-extensions] [23:20:36] Finished clean-extension-typescript-language-features-test-workspace after 1559 ms
[watch-extensions] [23:20:36] Starting watch-extension:typescript-language-features-test-workspace ...
[watch-extensions] [23:20:36] Finished clean-extension-typescript-language-features after 1562 ms
[watch-extensions] [23:20:36] Starting watch-extension:typescript-language-features ...
[watch-extensions] [23:20:36] Finished clean-extension-vscode-api-tests after 1600 ms
[watch-extensions] [23:20:36] Starting watch-extension:vscode-api-tests ...
[watch-extensions] [23:20:37] Finished clean-extension-vscode-colorize-tests after 1615 ms
[watch-extensions] [23:20:37] Starting watch-extension:vscode-colorize-tests ...
[watch-extensions] [23:20:37] Finished clean-extension-vscode-custom-editor-tests after 1621 ms
[watch-extensions] [23:20:37] Starting watch-extension:vscode-custom-editor-tests ...
[watch-extensions] [23:20:37] Finished clean-extension-vscode-notebook-tests after 1626 ms
[watch-extensions] [23:20:37] Starting watch-extension:vscode-notebook-tests ...
[watch-extensions] [23:20:37] Finished clean-extension-vscode-test-resolver after 1631 ms
[watch-extensions] [23:20:37] Starting watch-extension:vscode-test-resolver ...
[watch-extensions] [23:20:37] Finished clean-extension-configuration-editing-build after 1646 ms
[watch-extensions] [23:20:37] Starting watch-extension:configuration-editing-build ...
[watch-extensions] [23:20:37] Finished clean-extension-markdown-language-features-preview-src after 1677 ms
[watch-extensions] [23:20:37] Starting watch-extension:markdown-language-features-preview-src ...
[watch-extensions] [23:20:38] 'watch-extension-media' errored after 3.14 s
[watch-extensions] [23:20:38] Error: Command failed: /usr/bin/node /home/werner/Public/repo/github.com/microsoft/vscode.git/extensions/notebook-markdown-extensions/esbuild.js --watch
[watch-extensions] fs.js:114
[watch-extensions]     throw err;
[watch-extensions]     ^
[watch-extensions] 
[watch-extensions] Error: ENOENT: no such file or directory, stat '/home/werner/Public/repo/github.com/microsoft/vscode.git/extensions/notebook-markdown-extensions/node_modules/katex/dist/katex.min.css'
[watch-extensions]     at Object.statSync (fs.js:855:3)
[watch-extensions]     at Object.statSync (/home/werner/Public/repo/github.com/microsoft/vscode.git/node_modules/fs-extra/node_modules/graceful-fs/polyfills.js:307:34)
[watch-extensions]     at getStatsSync (/home/werner/Public/repo/github.com/microsoft/vscode.git/node_modules/fs-extra/lib/util/stat.js:58:18)
[watch-extensions]     at Object.checkPathsSync (/home/werner/Public/repo/github.com/microsoft/vscode.git/node_modules/fs-extra/lib/util/stat.js:90:33)
[watch-extensions]     at Object.copySync (/home/werner/Public/repo/github.com/microsoft/vscode.git/node_modules/fs-extra/lib/copy-sync/copy-sync.js:24:38)
[watch-extensions]     at Object.<anonymous> (/home/werner/Public/repo/github.com/microsoft/vscode.git/extensions/notebook-markdown-extensions/esbuild.js:35:5)
[watch-extensions]     at Module._compile (internal/modules/cjs/loader.js:778:30)
[watch-extensions]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
[watch-extensions]     at Module.load (internal/modules/cjs/loader.js:653:32)
[watch-extensions]     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
[watch-extensions]  > extensions/notebook-markdown-extensions/notebook/emoji.ts:7:22: error: Could not resolve "markdown-it-emoji" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
[watch-extensions]     7 │ const emoji = require('markdown-it-emoji');
[watch-extensions]       ╵                       ~~~~~~~~~~~~~~~~~~~
[watch-extensions] 
[watch-extensions]  > extensions/notebook-markdown-extensions/notebook/katex.ts:29:23: error: Could not resolve "@iktakahiro/markdown-it-katex" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
[watch-extensions]     29 │   const katex = require('@iktakahiro/markdown-it-katex');
[watch-extensions]        ╵                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[watch-extensions] 
[watch-extensions] 
[watch-extensions]     at ChildProcess.exithandler (child_process.js:294:12)
[watch-extensions]     at ChildProcess.emit (events.js:198:13)
[watch-extensions]     at ChildProcess.EventEmitter.emit (domain.js:466:23)
[watch-extensions]     at maybeClose (internal/child_process.js:982:16)
[watch-extensions]     at Socket.stream.socket.on (internal/child_process.js:389:11)
[watch-extensions]     at Socket.emit (events.js:198:13)
[watch-extensions]     at Socket.EventEmitter.emit (domain.js:466:23)
[watch-extensions]     at Pipe._handle.close (net.js:607:12)
[watch-client    ] [23:20:38] Starting compilation...
[watch-extensions] error Command failed with exit code 1.
[watch-extensions] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "watch-extensions" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Any hints for solving this problem?

Regards, HY

vscodebot[bot] commented 3 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

nrayburn-tech commented 3 years ago

I believe you should be using yarn, not npm.

I don't know what this line is for, I don't believe it is necessary. npm install --save-dev vscode-gulp-watch esbuild jsonc-parser parse-semver katex performance. Instead, you should just be doing yarn or yarn install.

So general steps to clone, compile, and open would be something like this.

git clone https://github.com/microsoft/vscode.git
cd vscode
yarn # Installs dependencies, including nested project dependencies.
yarn watch # Compiles, then watches the source code for changes.
# Open a new terminal for this next command.
./scripts/code.sh # This runs the compiled version.

This link may be helpful, https://github.com/microsoft/vscode/wiki/How-to-Contribute.

hongyi-zhao commented 3 years ago

On one of my Ubuntu 20.04 machines, I try to install yarn according to the official guide, but it failed with the following error:

$ sudo npm install --global yarn

> yarn@1.22.10 preinstall /usr/local/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

$ which yarn
$

On another Ubuntu 20.04 machine, though the yarn has been installed successfully, I meet the following error afterwards when running yarn under the top-level root directory of vscode's local repo:

$ yarn
yarn install v1.22.10
$ node build/npm/preinstall.js
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
warning @types/chokidar > chokidar > fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
warning gulp > glob-watcher > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning mocha > chokidar > fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info vscode-windows-ca-certs@0.3.0: The platform "linux" is incompatible with this module.
info "vscode-windows-ca-certs@0.3.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info vscode-windows-registry@1.0.3: The platform "linux" is incompatible with this module.
info "vscode-windows-registry@1.0.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-mutex@0.4.1: The platform "linux" is incompatible with this module.
info "windows-mutex@0.4.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-process-tree@0.3.0: The platform "linux" is incompatible with this module.
info "windows-process-tree@0.3.0" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > gulp-postcss@9.0.0" has unmet peer dependency "postcss@^8.0.0".
warning " > gulp-tsb@4.0.6" has incorrect peer dependency "typescript@^3.0.0".
[4/4] Building fresh packages...
[1/16] ⡀ keytar
[2/16] ⡀ native-is-elevated
[3/16] ⡀ native-keymap
[4/16] ⡀ native-watchdog
error /home/werner/Public/repo/github.com/microsoft/vscode.git/node_modules/native-is-elevated: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /home/werner/Public/repo/github.com/microsoft/vscode.git/node_modules/native-is-elevated
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@10.19.0 | linux | x64
gyp info find Python using Python version 3.8.5 found at "/usr/bin/python"
gyp info spawn /usr/bin/python
gyp info spawn args [ '/usr/share/nodejs/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/werner/Public/repo/github.com/microsoft/vscode.git/node_modules/native-is-elevated/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/share/nodejs/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/werner/.cache/node-gyp/12.0.7/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/werner/.cache/node-gyp/12.0.7',
gyp info spawn args   '-Dnode_gyp_dir=/usr/share/nodejs/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/werner/.cache/node-gyp/12.0.7/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/werner/Public/repo/github.com/microsoft/vscode.git/node_modules/native-is-elevated',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
Traceback (most recent call last):
  File "/usr/share/nodejs/node-gyp/gyp/gyp_main.py", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3254, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3237, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 584, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'gyp==0.1' distribution was not found and is required by the application
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/nodejs/node-gyp/lib/configure.js:355:16)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 5.4.0-42-generic
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/werner/Public/repo/github.com/microsoft/vscode.git/node_modules/native-is-elevated
gyp ERR! node -v v10.19.0

Any hints for solving these problems?

Regards, HY

hongyi-zhao commented 3 years ago

@nrayburn-tech Thank you very much.

According to the installation guide here, it seems the problem can be fixed by the following command:

$ sudo npm install -g node-gyp
#I have added the following command to install another possible dependency:
$ sudo npm install -g node-pty

Then your suggested compilation and running procedure will work like a charm:

git clone https://github.com/microsoft/vscode.git
cd vscode
yarn # Installs dependencies, including nested project dependencies.
yarn watch # Compiles, then watches the source code for changes.
# Open a new terminal for this next command.
./scripts/code.sh # This runs the compiled version.
hongyi-zhao commented 3 years ago

But on another Ubuntu 20.04 machine, I encountered the following error when issuing yarn commands:

$ yarn
yarn install v1.22.5
$ node build/npm/preinstall.js
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.1: The platform "linux" is incompatible with this module.
info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info vscode-windows-ca-certs@0.3.0: The platform "linux" is incompatible with this module.
info "vscode-windows-ca-certs@0.3.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.1: The platform "linux" is incompatible with this module.
info "fsevents@2.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info vscode-windows-registry@1.0.3: The platform "linux" is incompatible with this module.
info "vscode-windows-registry@1.0.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-mutex@0.4.1: The platform "linux" is incompatible with this module.
info "windows-mutex@0.4.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-process-tree@0.3.0: The platform "linux" is incompatible with this module.
info "windows-process-tree@0.3.0" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > gulp-postcss@9.0.0" has unmet peer dependency "postcss@^8.0.0".
warning " > gulp-tsb@4.0.6" has incorrect peer dependency "typescript@^3.0.0".
[4/4] Building fresh packages...
[1/15] ⠐ keytar
[6/15] ⠐ nsfw
[8/15] ⠐ vscode-ripgrep
[7/15] ⠐ spdlog
error /home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/keytar: Command failed.
Exit code: 1
Command: prebuild-install || npm run build
Arguments: 
Directory: /home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/keytar
Output:
prebuild-install WARN install No prebuilt binaries found (target=12.0.7 runtime=electron arch=x64 libc= platform=linux)
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1621905519343-0.09953397031551625/node but npm is using /usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> keytar@7.2.0 build /home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/keytar
> node-gyp rebuild

Traceback (most recent call last):
  File "/usr/share/nodejs/node-gyp/gyp/gyp_main.py", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3254, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3237, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 584, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'gyp==0.1' distribution was not found and is required by the application
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/nodejs/node-gyp/lib/configure.js:355:16)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 5.4.0-26-generic
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/keytar
gyp ERR! node -v v10.19.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keytar@7.2.0 build: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the keytar@7.2.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
nrayburn-tech commented 3 years ago

I think your issue is still related to installing yarn/node-gyp. You are more likely to get better help on stackoverflow than here. Sorry, I can't be much more help. I am not super familiar with Linux.

hongyi-zhao commented 3 years ago

Whether the following command must also be run, as I've posted previously?

$ sudo npm install -g node-pty

hongyi-zhao commented 3 years ago

It seems that this problem can be fixed by running the following commands immediately under the top-level root directory of vscode's local repo:

$ git clean -xdf
$ git pull
hongyi-zhao commented 3 years ago

But now I meet the following error:

$ yarn
yarn install v1.22.5
$ node build/npm/preinstall.js
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.1: The platform "linux" is incompatible with this module.
info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info vscode-windows-ca-certs@0.3.0: The platform "linux" is incompatible with this module.
info "vscode-windows-ca-certs@0.3.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.1: The platform "linux" is incompatible with this module.
info "fsevents@2.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info vscode-windows-registry@1.0.3: The platform "linux" is incompatible with this module.
info "vscode-windows-registry@1.0.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-mutex@0.4.1: The platform "linux" is incompatible with this module.
info "windows-mutex@0.4.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-process-tree@0.3.0: The platform "linux" is incompatible with this module.
info "windows-process-tree@0.3.0" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > gulp-postcss@9.0.0" has unmet peer dependency "postcss@^8.0.0".
warning " > gulp-tsb@4.0.6" has incorrect peer dependency "typescript@^3.0.0".
[4/4] Building fresh packages...
[6/15] ⠁ nsfw
[7/15] ⠂ spdlog
[11/15] ⠂ electron
[9/15] ⠂ vscode-sqlite3
error /home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/electron: Command failed.
Exit code: 1
Command: node install.js
Arguments: 
Directory: /home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/electron
Output:
RequestError: Client network socket disconnected before secure TLS connection was established
    at ClientRequest.request.once.error (/home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/got/source/request-as-event-emitter.js:178:14)
    at Object.onceWrapper (events.js:286:20)
    at ClientRequest.emit (events.js:203:15)
    at ClientRequest.origin.emit.args (/home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/@szmarczak/http-timer/source/index.js:37:11)
    at TLSSocket.socketErrorListener (_http_client.js:401:9)
    at TLSSocket.emit (events.js:198:13)
hongyi-zhao commented 3 years ago

I tried with yarn 1.22.10, but still meet the similar error as below:

$ yarn
yarn install v1.22.10
$ node build/npm/preinstall.js
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.1: The platform "linux" is incompatible with this module.
info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info vscode-windows-ca-certs@0.3.0: The platform "linux" is incompatible with this module.
info "vscode-windows-ca-certs@0.3.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.1: The platform "linux" is incompatible with this module.
info "fsevents@2.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info vscode-windows-registry@1.0.3: The platform "linux" is incompatible with this module.
info "vscode-windows-registry@1.0.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-mutex@0.4.1: The platform "linux" is incompatible with this module.
info "windows-mutex@0.4.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-process-tree@0.3.0: The platform "linux" is incompatible with this module.
info "windows-process-tree@0.3.0" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > gulp-postcss@9.0.0" has unmet peer dependency "postcss@^8.0.0".
warning " > gulp-tsb@4.0.6" has incorrect peer dependency "typescript@^3.0.0".
[4/4] Building fresh packages...
[6/15] ⠠ nsfw
[7/15] ⠠ spdlog
[11/15] ⠠ electron
[9/15] ⠠ vscode-sqlite3
error /home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/electron: Command failed.
Exit code: 1
Command: node install.js
Arguments: 
Directory: /home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/electron
Output:
RequestError: Client network socket disconnected before secure TLS connection was established
    at ClientRequest.request.once.error (/home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/got/source/request-as-event-emitter.js:178:14)
    at Object.onceWrapper (events.js:286:20)
    at ClientRequest.emit (events.js:203:15)
    at ClientRequest.origin.emit.args (/home/apollo/Public/repo/github.com/microsoft/vscode.git/node_modules/@szmarczak/http-timer/source/index.js:37:11)
    at TLSSocket.socketErrorListener (_http_client.js:401:9)
    at TLSSocket.emit (events.js:198:13)
hongyi-zhao commented 3 years ago

Presumably, the problem was caused by the proxy settings used by npm and yarn. It seems that the settings below can solve this problem:

werner@X10DAi:~$ npm config list|grep -A5 '; "user'
; "user" config from /home/werner/.npmrc

https-proxy = "http://127.0.0.1:8080/" 
proxy = "http://127.0.0.1:8080/" 
strict-ssl = false 

werner@X10DAi:~$ cat .yarnrc 
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

proxy "http://127.0.0.1:8080"
https-proxy "http://127.0.0.1:8080"
lastUpdateCheck 1621894410752
strict-ssl=false true
lramos15 commented 2 years ago

Glad you figured it out 👍 . I've never had this many issues compiling VS Code sources on ubuntu and just follow the wiki. Thanks for documenting these issues and their workarounds.