Skip to content

update npm installation docs with node requirements #2745

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
mrfoxie opened this issue Feb 19, 2021 · 37 comments · Fixed by #2850
Closed

update npm installation docs with node requirements #2745

mrfoxie opened this issue Feb 19, 2021 · 37 comments · Fixed by #2850
Labels
docs Documentation related
Milestone

Comments

@mrfoxie
Copy link
Contributor

mrfoxie commented Feb 19, 2021

  • Web Browser: Chrome
  • Local OS: Android 8.1
  • Remote OS: Android 8.1
  • code-server --version: 3.9.0 fc6d123

I tried to install on termux using falling commands

pkg install nano yarn
yarn global add code-server

after then when I execute the command code-server or code-server --auth none and then I open url in chrome browser I get this error
Screenshot_20210219_202138

this is the log of termux while running code-server
Screenshot_2021_0219_202202

@jsjoeio
Copy link
Contributor

jsjoeio commented Feb 22, 2021

Hmm...I wish I had an Android device to try and reproduce this.

Usually when you see this error, it means VSCode isn't done building. I see the "error VS Code exited unexpectedly with code 0". But since you already installed code-server with yarn, it should be finished 🤔

I wonder if that failed in some way. Maybe you can check the logs from after running yarn global add code-server

@jsjoeio jsjoeio added the waiting-for-info Waiting for more information from submitter label Feb 22, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented Feb 22, 2021

@Playit3110
Copy link

I tried to install it code-server over codeserver.dev/install.sh and noticed a lot of old or broken dependencies. I tried to run it as well and got a simular result. The only difference is my remote OS. It is a Raspberry Pi 4 4GB

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 1, 2021

noticed a lot of old or broken dependencies

Well that's no good!

Can you try following these steps and let me know if the result is the same?

@Playit3110
Copy link

Playit3110 commented Mar 1, 2021

Im not quiet sure which steps i should follow. Could you link to the issue or the comment here?

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 1, 2021

Sorry looks like the link didn't get added! Updated the comment

@Playit3110
Copy link

I already tried that too but i got the error global is not a file when i executed yarn global ...

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 1, 2021

Hmm..strange. Can you please post the logs or a screenshot so I can see if I can reproduce your error?

@Playit3110
Copy link

Playit3110 commented Mar 1, 2021

Here is the process:

Last login: Tue Mar  2 01:04:12 2021 from 192.168.2.xxx
pi@server:~ $ sudo apt update && apt upgrade
Get:1 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Hit:3 https://deb.nodesource.com/node_14.x buster InRelease
Fetched 15.0 kB in 1s (11.8 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
pi@server:~ $ sudo apt install build-essential python git nodejs yarn
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'cmdtest' instead of 'yarn'
build-essential is already the newest version (12.6).
git is already the newest version (1:2.20.1-2+deb10u3).
python is already the newest version (2.7.16-1).
nodejs is already the newest version (14.16.0-1nodesource1).
The following additional packages will be installed:
  libyaml-0-2 python-cliapp python-markdown python-pygments
  python-ttystatus python-yaml
Suggested packages:
  python-markdown-doc python-pygments-doc ttf-bitstream-vera
The following NEW packages will be installed:
  cmdtest libyaml-0-2 python-cliapp python-markdown
  python-pygments python-ttystatus python-yaml
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 892 kB of archives.
After this operation, 4,565 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.agdsn.de/pub/mirrors/raspbian/raspbian buster/main armhf libyaml-0-2 armhf 0.2.1-1 [38.8 kB]
Get:2 http://ftp.agdsn.de/pub/mirrors/raspbian/raspbian buster/main armhf python-yaml armhf 3.13-2 [118 kB]
Get:3 http://ftp.agdsn.de/pub/mirrors/raspbian/raspbian buster/main armhf python-cliapp all 1.20180812.1-2 [42.2 kB]
Get:4 http://ftp.agdsn.de/pub/mirrors/raspbian/raspbian buster/main armhf python-ttystatus all 0.38-2 [15.4 kB]
Get:5 http://ftp.agdsn.de/pub/mirrors/raspbian/raspbian buster/main armhf python-markdown all 3.0.1-3 [60.6 kB]
Get:6 http://ftp.agdsn.de/pub/mirrors/raspbian/raspbian buster/main armhf cmdtest all 0.32-3 [21.9 kB]
Get:7 http://ftp.agdsn.de/pub/mirrors/raspbian/raspbian buster/main armhf python-pygments all 2.3.1+dfsg-1 [596 kB]
Fetched 892 kB in 2s (405 kB/s)
Selecting previously unselected package libyaml-0-2:armhf.
(Reading database ... 111866 files and directories currently installed.)
Preparing to unpack .../0-libyaml-0-2_0.2.1-1_armhf.deb ...
Unpacking libyaml-0-2:armhf (0.2.1-1) ...
Selecting previously unselected package python-yaml.
Preparing to unpack .../1-python-yaml_3.13-2_armhf.deb ...
Unpacking python-yaml (3.13-2) ...
Selecting previously unselected package python-cliapp.
Preparing to unpack .../2-python-cliapp_1.20180812.1-2_all.deb ...
Unpacking python-cliapp (1.20180812.1-2) ...
Selecting previously unselected package python-ttystatus.
Preparing to unpack .../3-python-ttystatus_0.38-2_all.deb ...
Unpacking python-ttystatus (0.38-2) ...
Selecting previously unselected package python-markdown.
Preparing to unpack .../4-python-markdown_3.0.1-3_all.deb ...
Unpacking python-markdown (3.0.1-3) ...
Selecting previously unselected package cmdtest.
Preparing to unpack .../5-cmdtest_0.32-3_all.deb ...
Unpacking cmdtest (0.32-3) ...
Selecting previously unselected package python-pygments.
Preparing to unpack .../6-python-pygments_2.3.1+dfsg-1_all.deb ...
Unpacking python-pygments (2.3.1+dfsg-1) ...
Setting up libyaml-0-2:armhf (0.2.1-1) ...
Setting up python-ttystatus (0.38-2) ...
Setting up python-markdown (3.0.1-3) ...
Setting up python-pygments (2.3.1+dfsg-1) ...
Setting up python-yaml (3.13-2) ...
Setting up python-cliapp (1.20180812.1-2) ...
Setting up cmdtest (0.32-3) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...
pi@server:~ $ yarn global add code-server
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'global'
pi@server:~ $

If you need a log, you have to help me where it is saved, because i have no idea

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 1, 2021

Okay these might be dumb questions but bear with me.

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

  1. Does apt upgrade need to be run with sudo?

Note, selecting 'cmdtest' instead of 'yarn'

  1. Could that be an issue? Guessing it's using cmdtest which doesn't have a global command?

I found this potential fix that might work? (source):

sudo apt remove cmdtest
sudo apt remove yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

@Playit3110
Copy link

Wow thanks a lot. Till now no error

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 1, 2021

Sure thing! If it ends up working, feel free to close this issue!

@Playit3110
Copy link

Playit3110 commented Mar 2, 2021

Sadly it still breaks when i try to log in. :(

500

VS Code failed to load. exited unexpectedly with code 0

Where can i see the logs of code-server

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 2, 2021

Dang it! We were too optimistic too soon. Run code-server like so:

code-server --log debug

More info here in the docs.

@Playit3110
Copy link

Here the console:

Last login: Tue Mar  2 17:19:07 2021 from xxx.xxx.xxx.xxx
pi@server:~ $ code-server --log debug
-bash: code-server: command not found
pi@server:~ $ ~/.yarn/bin/code-server --log debug
[2021-03-02T17:20:01.051Z] info  code-server 3.9.0 fc6d123da59a4e5a675ac8e080f66e032ba01a1b
[2021-03-02T17:20:01.054Z] info  Using user-data-dir ~/.local/share/code-server
[2021-03-02T17:20:01.124Z] info  Using config file ~/.config/code-server/config.yaml
[2021-03-02T17:20:01.124Z] info  HTTP server listening on http://0.0.0.0:8080
[2021-03-02T17:20:01.125Z] info    - Authentication is enabled
[2021-03-02T17:20:01.125Z] info      - Using password from ~/.config/code-server/config.yaml
[2021-03-02T17:20:01.125Z] info    - Using certificate for HTTPS: ~/.local/share/code-server/localhost.crt
[2021-03-02T17:20:46.242Z] debug redirecting from / to ./login
[2021-03-02T17:20:55.218Z] debug no valid cookie doman {"host":"192.168.2.110"}
[2021-03-02T17:20:55.222Z] debug redirecting from /login to ./
[2021-03-02T17:20:55.389Z] debug forking vs code...
[2021-03-02T17:20:56.338Z] error VS Code exited unexpectedly with code 0
^C[2021-03-02T17:21:24.551Z] debug child:20982 disposing {"code":"SIGINT"}
pi@server:~ $

Still no success

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 2, 2021

Those logs aren't very helpful. They don't tell us too much :(

If VS Code is exiting, then I have to guess that there's a missing dependency or something. Honestly, we should have something like a doctor command which checks for all the dependencies needed to run code-server.

Hmm...a few things:

  • can you post your system info?
    • OS, browser, application (i.e. Termux version)
  • can you post the dependency versions for the following:
    • build-essential python git nodejs yarn

That might help us get to the bottom of this

@code-asher
Copy link
Member

code-asher commented Mar 2, 2021

In addition, here's a list of required dependencies to build with yarn: https://github.com/cdr/code-server/blob/v3.9.0/docs/npm.md#npm-install-requirements

It might help to to re-install VS Code Node modules and post the log if there are any failures. Maybe something like:

$ cd $(yarn global dir)/node_modules/code-server/lib/vscode
$ yarn --check-files

@Playit3110
Copy link

Playit3110 commented Mar 2, 2021

Here is the install process of the libaries:

Last login: Tue Mar  2 18:27:32 2021 from 192.168.2.xxx
pi@server:~ $ sudo apt-get install build-essential pkg-config libx11-dev libxkbfile-dev libsecret-1-dev python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.6).
libsecret-1-dev is already the newest version (0.18.7-1).
libx11-dev is already the newest version (2:1.6.7-1+deb10u1).
libxkbfile-dev is already the newest version (1:1.0.9-2).
pkg-config is already the newest version (0.29-6).
python3 is already the newest version (3.7.3-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@server:~ $ npm config set python python3
pi@server:~ $

And here are the dependencies which show my first problem, where a lot of them are old or deprecated or moved

Last login: Tue Mar  2 18:29:47 2021 from 192.168.2.xxx
pi@server:~ $ cd $(yarn global dir)/node_modules/code-server/lib/vscode
pi@server:~/.config/yarn/global/node_modules/code-server/lib/vscode $ yarn --check-files
yarn install v1.22.5
warning ../../../../package.json: No license field
info No lockfile found.
[1/4] Resolving packages...
warning chokidar > [email protected]: "Please update to latest v2.3 or v2.2"
warning @types/[email protected]: This is a stub types definition for applicationinsights (https://github.com/Microsoft/ApplicationInsights-node.js). applicationinsights provides its own type definitions, so you don't need @types/applicationinsights installed!
warning @types/[email protected]: This is a stub types definition. chokidar provides its own type definitions, so you do not need this installed.
warning @types/[email protected]: This is a stub types definition. keytar provides its own type definitions, so you do not need this installed.
warning cson-parser > [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
warning gulp > glob-watcher > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning gulp > glob-watcher > chokidar > [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning gulp > glob-watcher > chokidar > braces > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
warning gulp > glob-watcher > chokidar > braces > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
warning gulp-azure-storage > azure-storage > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning gulp-azure-storage > azure-storage > request > [email protected]: this library is no longer supported
warning gulp-cssnano > cssnano > postcss-merge-rules > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning gulp-cssnano > cssnano > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning gulp-cssnano > cssnano > postcss-merge-rules > caniuse-api > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning gulp-remote-retry-src > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning jsdom-no-contextify > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning mocha > [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
warning mocha > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning mocha > [email protected]: to-iso-string has been deprecated, use @segment/to-iso-string instead.
warning mocha > [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
warning mocha > jade > [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
warning [email protected]: The package has been renamed to `open`
warning sinon > [email protected]: This package has been deprecated in favour of @sinonjs/samsam
warning sinon > [email protected]: This package is unmaintained. Use @sinonjs/formatio instead
warning sinon > formatio > [email protected]: This package has been deprecated in favour of @sinonjs/samsam
warning vsce > cheerio > [email protected]: Use cheerio-select instead
warning webpack > watchpack > watchpack-chokidar2 > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > @coder/[email protected]" has unmet peer dependency "@google-cloud/logging@^4.5.2".
warning " > [email protected]" has incorrect peer dependency "eslint@>=7.0.0".
warning " > [email protected]" has incorrect peer dependency "typescript@^3.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 694.93s.
pi@server:~/.config/yarn/global/node_modules/code-server/lib/vscode $

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 2, 2021

Great. All that looks fine to me. What version of node and yarn are you using?

node --version
yarn --version

And have you tried the suggestion by @code-asher ?

@Playit3110
Copy link

I have. It is the first log i commented above.

Here the versions:

Last login: Tue Mar  2 18:32:09 2021 from 192.168.2.xxx
pi@server:~ $ yarn --version
1.22.5
pi@server:~ $ node --version
v14.16.0
pi@server:~ $

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 2, 2021

Ah, sorry missed that!

Hmm...I wonder if it could be an issue with your node version. I know I've run into funky errors with local development and vscode itself recommends <= 14.x

Can you try downgrading node versions to either something that is >= 10.x and <= 14.x and then reinstalling code-server?

@Playit3110
Copy link

Im sorry to ask but how can i downgrade. I dont work that much with node

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 2, 2021

No worries at all! I usually use a tool called nvm. Here's a ~1min video about using nvm: link

What you'll do is something like:

  1. install nvm
  2. install an older version of node: nvm install 12.16.1
  3. set the default to that version: nvm alias default 12.16.1
  4. restart your shell

@Playit3110
Copy link

It works now. Thanks a lot. :)

@Playit3110
Copy link

I think we need to install the right version of node to make it working for other people.

@Playit3110
Copy link

One thing, is there a easy way to rebuilt code-server if it is already installed?

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 2, 2021

Yes, we should update the docs. I'll change this issue to match that.

@jsjoeio jsjoeio added docs Documentation related and removed waiting-for-info Waiting for more information from submitter labels Mar 2, 2021
@jsjoeio jsjoeio changed the title Android 500 error update installation npm installation docs with node requirements Mar 2, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 2, 2021

One thing, is there a easy way to rebuilt code-server if it is already installed?

Hmm... sorry can you elaborate a little bit on what you mean? If you have it installed with yarn, you shouldn't have to rebuild it hopefully, only stop/restart.

@Playit3110
Copy link

If that works then it is ok

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 2, 2021

Should we close this now?

@Playit3110
Copy link

Sure

@Playit3110
Copy link

But i cant close it

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 3, 2021

ha! no worries, i can!

@jsjoeio jsjoeio closed this as completed Mar 3, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 3, 2021

actually, i still want us to update the docs. so we'll close after we do that!

@jsjoeio jsjoeio reopened this Mar 3, 2021
@Playit3110
Copy link

Thats a good idea

@jsjoeio jsjoeio changed the title update installation npm installation docs with node requirements update npm installation docs with node requirements Mar 3, 2021
@Vishalrakse
Copy link

Screenshot_2023-03-27-10-32-36-36_84d3000e3f4017145260f7618db1d683.jpg

Pleas help me
help me
help me
I am vishal
I belong to bhopal.

And
Thank so much
Pleas replay
Tha setuation.

@code-asher
Copy link
Member

code-asher commented Mar 27, 2023

You will need to use Node v16 with code-server, not v19.

https://github.com/coder/code-server/blob/main/docs/termux.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants