Skip to content

Cannot install the NPM package without X11 anymore (aka missing modifications on vendored vscode?) #4179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
edvincent opened this issue Sep 15, 2021 · 6 comments · Fixed by #4192
Assignees
Labels
bug Something isn't working high-priority This issue needs to be resolved ASAP

Comments

@edvincent
Copy link
Contributor

edvincent commented Sep 15, 2021

In the end, this might be a documentation update needed - but cutting as a bug report because stuff that used to work without problems for the last couple of releases doesn't work anymore... If only, knowing whether this was voluntary or a miss would be useful :D

OS/Web Information

Linux, with 3.12's NPM package (and I'd expect the same thing to happen for building it from source too?)

Steps to Reproduce

Try to install the npm package on a machine without X11.

Even more precisely, with a newly-spinned EC2 instance running Ubuntu 20.4:

# Install and upgrade node
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.bashrc
nvm install v14.17.6

# Install the couple dependencies to install from the NPM package
sudo apt-get update
sudo apt-get install pkg-config
sudo apt-get install make
sudo apt-get install g++

# Install code-server itself
npm install -g code-server

Expected

That should work because I'd expect patches like #2961 and all the details/modifications highlighted in https://github.com/cdr/code-server/blob/v3.12.0/docs/CONTRIBUTING.md#modifications-to-vs-code to still apply.

Namely, stuff like libx11 and libxkbfile should not be needed anymore.

Actual

During the installation, when pulling native-keymap, when it rebuilds node-gyp with node-gyp rebuild, it tries to run ${PKG_CONFIG:-pkg-config} x11 xkbfile --libs which relies on x11 and libxkbfile, and it fails.

Logs

[4/4] Building fresh packages...
[1/10] ⠈ @vscode/sqlite3
[2/10] ⠈ keytar
[3/10] ⠈ native-is-elevated
[4/10] ⠈ native-keymap
error /home/ubuntu/.nvm/versions/node/v14.17.6/lib/node_modules/code-server/vendor/modules/code-oss-dev/node_modules/native-keymap: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /home/ubuntu/.nvm/versions/node/v14.17.6/lib/node_modules/code-server/vendor/modules/code-oss-dev/node_modules/native-keymap
Output:
Package x11 was not found in the pkg-config search path.
Perhaps you should add the directory containing `x11.pc'
to the PKG_CONFIG_PATH environment variable
No package 'x11' found
Package xkbfile was not found in the pkg-config search path.
Perhaps you should add the directory containing `xkbfile.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xkbfile' found
gyp: Call to '${PKG_CONFIG:-pkg-config} x11 xkbfile --cflags | sed s/-I//g' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/ubuntu/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 5.4.0-1018-aws
gyp ERR! command "/home/ubuntu/.nvm/versions/node/v14.17.6/bin/node" "/home/ubuntu/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ubuntu/.nvm/versions/node/v14.17.6/lib/node_modules/code-server/vendor/modules/code-oss-dev/node_modules/native-keymap

Screenshot

N/A

Notes

This issue can be reproduced in VS Code: No

@jsjoeio
Copy link
Contributor

jsjoeio commented Sep 15, 2021

Thank you for the detailed report @edvincent!

We made quite a few changes with how code-server bundles VS Code so very possible we missed some things. We'll investigate!

cc @TeffenEllis

@GirlBossRush
Copy link
Contributor

GirlBossRush commented Sep 15, 2021

@edvincent,

Thanks for bringing this to our attention. 3.12.0 includes a large code cleanup and as you’ve experienced first hand, some regressions have slipped through. We’ll be releasing a fix most likely within the next day or so, along with a few other improvements.

@edvincent
Copy link
Contributor Author

Yup been following myself those changes (which I love and definitely make the repo nicer, nice work @TeffenEllis!), and I'm not sure where (if any?) the modifications that used to be done on top of the vscode imports were done with the new vendored code..

Couldn't see that in any of the PR's :/ In which case there might be other features "broken" if the patches are missing... Happy to help tracking (and testing) some of those if someone can point me to where we brought the modifications - and see what we might have missed?

I added some more exact reproduction steps in the issue itself (which I used to ensure my machine wasn't the problem), though they are likely superfluous now :D

@GirlBossRush
Copy link
Contributor

@edvincent,

…I'm not sure where (if any?) the modifications that used to be done on top of the vscode imports were done with the new vendored code..

Bingo. That’s just one of the many reasons I pushed for a fork of the vendored VS Code. In the not too distant future we’ll have almost everything over on the fork, which will let us use Git and Github’s built-in tooling as upstream changes come through.

Regarding this regression,

There’s an obvious solution which would be porting over our patch which removes these dependencies, but if I can manage it, keeping them as optional dependencies would be ideal since we wouldn’t have to diverge from upstream too much. We should have an update later today.

Thanks much 🙏

@GirlBossRush GirlBossRush self-assigned this Sep 16, 2021
@GirlBossRush GirlBossRush added this to the 3.12.1 milestone Sep 16, 2021
GirlBossRush added a commit to coder/vscode that referenced this issue Sep 16, 2021
@GirlBossRush GirlBossRush added bug Something isn't working high-priority This issue needs to be resolved ASAP labels Sep 16, 2021
GirlBossRush added a commit to coder/vscode that referenced this issue Sep 16, 2021
@everyplace
Copy link

I don’t know if this warrants either re-opening this, or filing it as a new bug, but I ran into a related problem today doing a clean install on a Pi Zero 2. In researching the xkbfile dependency, I came across this post re: preemptively installing dependencies, and it did the trick for me.

@everyplace
Copy link

For anyone else’s benefit when searching for xkbfile in the future, to install the prerequisite dependencies:

sudo apt-get install -y g++ gcc make python2.7 pkg-config libx11-dev libxkbfile-dev libsecret-1-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high-priority This issue needs to be resolved ASAP
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants