Closed hongyi-zhao closed 2 years ago
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
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.
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
@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.
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.
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.
Whether the following command must also be run, as I've posted previously?
$ sudo npm install -g node-pty
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
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)
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)
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
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.
On Ubuntu 20.04, I try to compile the git master version of vscode with the following steps:
Any hints for solving this problem?
Regards, HY