coder / code-server

VS Code in the browser
https://coder.com
MIT License
68.01k stars 5.59k forks source link

Support and publish Windows release #1397

Open nhooyr opened 4 years ago

nhooyr commented 4 years ago
danny-laa commented 4 years ago

@nhooyr Any updates? Does 3.0 release support Windows?

nhooyr commented 4 years ago

There are no self contained windows releases yet.

We haven't tested but the npm package might work on windows. yarn global add code-server

max-hk commented 4 years ago

There are no self contained windows releases yet.

We haven't tested but the npm package might work on windows. yarn global add code-server

I was able to install the npm package in windows, but I encounter a few bugs,

  1. src/browser/media/manifest.json not found

  2. All vscode-remote-resource path returns 404 not found, but this bug can easily be solved by removing leading slash in the path agument, eg.

    http://127.0.0.1:8080/vscode-remote-resource?path=/c:/Users/Max/AppData/Local/Yarn/Data/global/node_modules/@coder/code-server/lib/vscode/extensions/markdown-basics/language-configuration.json
    ➡ 404 not found

    http://127.0.0.1:8080/vscode-remote-resource?path=c:/Users/Max/AppData/Local/Yarn/Data/global/node_modules/@coder/code-server/lib/vscode/extensions/markdown-basics/language-configuration.json
    ➡ Correct path

  3. Syntax highlighting, extensions and themes not working (because of 2)

  4. Automatic update not working because https://github.com/cdr/code-server/releases/download/3.2.0/code-server-3.2.0-win32-x86_64.tar.gz does not exist

Furthermore, running the post install scripts requires Visual Studio and "VC++ 2015.3 v140 toolset for desktop (x86,x64)" to be installed, but since running code-server does not require electron to be built, I think it may be unnecessary.

nhooyr commented 4 years ago

@maxloh Awesome thanks for looking into it!

nhooyr commented 4 years ago

The package is now just code-server on npm. We were able to get ownership from the previous owner.

src/browser/media/manifest.json not found

Fixed.

All vscode-remote-resource path returns 404 not found, but this bug can easily be solved by removing leading slash in the path agument, eg.

@code-asher

Automatic update not working because https://github.com/cdr/code-server/releases/download/3.2.0/code-server-3.2.0-win32-x86_64.tar.gz does not exist

We'll be removing automatic updates soon. See #1532 .

Furthermore, running the post install scripts requires Visual Studio and "VC++ 2015.3 v140 toolset for desktop (x86,x64)" to be installed, but since running code-server does not require electron to be built, I think it may be unnecessary.

Will mention this in docs, it is required as vscode uses native modules that have to be built.

nhooyr commented 4 years ago

Asher has fixed the paths, will publish a new release soon.

nhooyr commented 4 years ago

We're going to need to test/rewrite any shell scripts that will have to run on Windows.

nhooyr commented 4 years ago

Marking this for v3.4.0, couldn't test/get CI going in time for v3.3.0

EriKWDev commented 4 years ago

How's the progress going for the windows release? :) edit: spelling

fearthecowboy commented 4 years ago

I only have a couple of minutes, and wanted to dump a couple notes here for y'all

I had trouble running code-server in development mode, because of a string smashing bug in http.ts

csStaticBase: base + "/static/" + this.options.commit + this.rootPath, probably should be csStaticBase: path.join( base, "/static/", this.options.commit , this.rootPath),

Oddly, this didn't affect it running the npm package version in windows (when I got that hacked about and running).

(sorry for the dump, I'll try to come back and put a PR in if I get time)

Fixing that, things started working, but I ran into cases where it's failing to read the settings (which means that nothing can be changed)

Unable to read file vscode-userdata:/c:/Users/garre/AppData/Local/code-server/Data/settings.json (Error: Unable to resolve non-existing file vscode-userdata:/c:/Users/garre/AppData/Local/code-server/Data/settings.json)

I went and created a file there, but it still wouldn't go. I haven't gone to look if it's just not liking the slash at the front or what.

fearthecowboy commented 4 years ago

The other problem I had was actually using a terminal window -- it'll start up powershell, but can't interact with the frame at all. Haven't looked into that either.

code-asher commented 4 years ago

csStaticBase is used for assets loaded by the browser so I think it needs to be /. Although I think browsers will automatically convert so it shouldn't be a problem either way. But if doing that fixed something then it's very possible we're mis-using it somewhere.

I think you're right about the leading slash. I ran this on Windows:

> fs.existsSync("/c:/Users")
false
> fs.existsSync("c:/Users")
true
fearthecowboy commented 4 years ago

If you want to make the path always use forward slashes then I'd still go with

path.join( base, "/static/", this.options.commit , this.rootPath).replace(/\//g,'/') or something that smartly puts separators in, as the string smashing was missing a slash between development and the rest of the path. (IIRC ...static/developmentc:\...)

code-asher commented 4 years ago

Ahhh that makes sense. That's a good point.

bpmct commented 3 years ago

Publishing a windows release of cloud-agent will also make it possible to use --link with Windows.

Suggested steps to improve Windows support

bpmct commented 3 years ago

Was able to install successfully without WSL, but see these errors: https://github.com/cdr/code-server/blob/ddee4f748c693c26b19af964994907c7eeef6828/lib/vscode/src/vs/platform/terminal/node/terminalProfiles.ts#L120-L134

max-hk commented 3 years ago

@bpmct npm's default script-shell failed to run the postinstall script on Windows.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! code-server@3.11.1 postinstall: `./postinstall.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the code-server@3.11.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

It could be fixed by runing the postinstall script explicitly with bash, so that Windows will run the script with the default bash executable.

https://github.com/cdr/code-server/blob/316c3aa999fef8d92fd39018901a9fe5c26e129e/ci/build/build-release.sh#L51

-       "postinstall": "./postinstall.sh" 
+       "postinstall": "bash ./postinstall.sh" 
max-hk commented 3 years ago

I installed code-server successfully with script-shell set to a portable git bash release (with no spaces in its path, because of this issue) and run npm i -g code-server with powershell.

Running npm i -g code-server in Git Bash doesn't work. Bash will fail to find the installed yarn executable when running the postinstall script.

locdhthtb commented 3 years ago

wao

I installed code-server successfully with script-shell set to a portable git bash release (with no spaces in its path) and run npm i -g code-server with powershell.

Running npm i -g code-server in Git Bash doesn't work. Bash will fail to find the installed yarn executable when running the postinstall script.

thank you i's just try it 🍡 hope it work

bpmct commented 3 years ago

I installed code-server successfully with script-shell set to a portable git bash release (with no spaces in its path) and run npm i -g code-server with powershell.

Running npm i -g code-server in Git Bash doesn't work. Bash will fail to find the installed yarn executable when running the postinstall script.

Does this mean you had to do it with yarn or you just used Powershell instead?

max-hk commented 3 years ago

Does this mean you had to do it with yarn or you just used Powershell instead?

The postinstall script setup vscode's extensions with yarn.

https://github.com/cdr/code-server/blob/911af4075f111f5c47700fbc731978bb65941a56/ci/build/npm-postinstall.sh#L89-L104

If I run npm i -g code-server with git bash, the proccess running postinstall script will be spawned by git bash, and it doesn't recognize yarn for some reason.

image

However, if npm i -g code-server was run with powershell, it setup extensions sucessfully.

image


It is worth mentioning that I have volta installed in my machine, which have integrations with npm global install commands.

locdhthtb commented 3 years ago

I installed code-server successfully with script-shell set to a portable git bash release (with no spaces in its path, because of this) and run npm i -g code-server with powershell.

Running npm i -g code-server in Git Bash doesn't work. Bash will fail to find the installed yarn executable when running the postinstall script.

How you run it, @max-hk

in cmd

code-server i'm get error

internal/modules/cjs/loader.js:892 throw err; ^

max-hk commented 3 years ago

@locdhthtb I do not have any problem running code-server with either cmd, powershell or git bash.

Can you post the complete error message here?

locdhthtb commented 3 years ago

thanks @max-hk so much! i resolved it, 🍡

uninstall code-server from npm

max-hk commented 3 years ago

Builtin image viewer and integrated terminal won't work until I run npm rebuild in code-server/lib/vscode/node_modules/.

QuYue commented 3 years ago

I have installed code-server successfully by yarn. But there are existing a lot of errors. I'm not sure the reasons which cause these errors.

  1. When I create a file or folder. The notifications will show "Running File Create participants..." for a long time.
  2. When I want to open the terminal by (ctrl+J), then an error will be reported as follows: """ The terminal process failed to launch: A native exception occurred during launch (Cannot find module '../build/Release/pty.node' Require stack:
    • c:\Users\quyue\AppData\Local\Yarn\Data\global\node_modules\code-server\lib\vscode\node_modules\node-pty\lib\windowsPtyAgent.js
    • c:\Users\quyue\AppData\Local\Yarn\Data\global\node_modules\code-server\lib\vscode\node_modules\node-pty\lib\windowsTerminal.js
    • c:\Users\quyue\AppData\Local\Yarn\Data\global\node_modules\code-server\lib\vscode\node_modules\node-pty\lib\index.js
    • c:\Users\quyue\AppData\Local\Yarn\Data\global\node_modules\code-server\lib\vscode\out\bootstrap-amd.js
    • c:\Users\quyue\AppData\Local\Yarn\Data\global\node_modules\code-server\lib\vscode\out\bootstrap-fork.js). """
  3. When I open a markdown file, I could not open the preview to the side.
  4. My terminal for running code-server always show image
max-hk commented 3 years ago

Builtin image viewer and integrated terminal won't work until I run npm rebuild in code-server/lib/vscode/node_modules/.

@QuYue For (2), try my fix above. In your case, the folder should be c:\Users\quyue\AppData\Local\Yarn\Data\global\node_modules\code-server\lib\vscode\node_modules\

QuYue commented 3 years ago

@max-hk Wow, It works! What's more, this method can not only open terminal , but also solve (1) (3)(4). Thank you very much!

QuYue commented 3 years ago

Another error, my builtin image viewer can not work, although I run npm rebuild. It will show "An error occurred while loading the image".

And there is always an error message as follows: image

max-hk commented 3 years ago

@QuYue It works on my machine. Do you see any error message printed to browser's console?

QuYue commented 3 years ago

@max-hk No, I don't find any error message in browser... But I find another problem, I don't know whether it is related to the above problem or not. When I stop the code-server and do not close the page of “localhost:5941” in browser. Then when I start the code-server, It will show this message: image

max-hk commented 3 years ago

Try digging in the Network tab of DevTool. Do you see any failed request after opening an image?

max-hk commented 3 years ago

@max-hk No, I don't find any error message in browser... But I find another problem, I don't know whether it is related to the above problem or not. When I stop the code-server and do not close the page of “localhost:5941” in browser. Then when I start the code-server, It will show this message: image

I have this error message in my machine too, but everything just work.

QuYue commented 3 years ago

image localhost-1630946189386.log

QuYue commented 3 years ago

Oh, I found the same issue in https://github.com/cdr/code-server/issues/3936. It seems like a general problem for 3.11.1 version. Maybe I should install an old version of code-server.

QuYue commented 3 years ago

Oh, I found the same issue in #3936. It seems like a general problem for 3.11.1 version. Maybe I should install an old version of code-server.

Well, when I use 3.9, the image can be shown now.

bpmct commented 3 years ago

If anyone runs into Cannot find module '../build/Release/pty.node', see the troubleshooting steps in https://github.com/cdr/code-server/issues/4115#issuecomment-914480270. We're not entirely sure what it was that fixed it, but all steps are listed.

bpmct commented 3 years ago

@bpmct npm's default script-shell failed to run the postinstall script on Windows.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! code-server@3.11.1 postinstall: `./postinstall.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the code-server@3.11.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

It could be fixed by runing the postinstall script explicitly with bash, so that Windows will run the script with the default bash executable.

https://github.com/cdr/code-server/blob/316c3aa999fef8d92fd39018901a9fe5c26e129e/ci/build/build-release.sh#L51

-       "postinstall": "./postinstall.sh" 
+       "postinstall": "bash ./postinstall.sh" 

@max-hk can you submit a pull request for this?

max-hk commented 3 years ago

@bpmct Done.

I changed my username recently.

mikelmulti460 commented 2 years ago

Hello at the end of the installation I get the following errors. I have run the postinstall manually and I get the same. What I can do? errors-codeserver.txt

code-asher commented 2 years ago

How are you doing the installation? Do you have node on your path?

mikelmulti460 commented 2 years ago

How are you doing the installation? Do you have node on your path?

yes, I have node in my path I am using: npm i -g code-server if i use install by yarn I get the following error:

image

mikelmulti460 commented 2 years ago

Hello at the end of the installation I get the following errors. I have run the postinstall manually and I get the same. What I can do? errors-codeserver.txt

I have solved it by installing with npm from Git Bash it is strange that it cannot be installed from cmd or powershell

code-asher commented 2 years ago

Huh interesting! Sounds like something we will need to look into as part of this issue.

lavahasif commented 2 years ago

This worked for me unfold C:\Users\"your user"\AppData\Local\Yarn\Data\global\node_modules\code-server run postinstall using gitbash run yarn install in git bash .it will work .node version switch to 14.17.0

ivanjx commented 2 years ago

@lavahasif when running the postinstall i keep getting mklink not found and cannot open the terminal with error:

The terminal process failed to launch: A native exception occurred during launch (Cannot find module '../build/Release/pty.node'
wizpresso-steve-cy-fan commented 1 year ago

Instead of installing spdlog use this:

$ npm i -g @microsoft/1ds-core-js minimist yauzl yazl @vscode/spdlog xterm-headless
suhrob008 commented 1 year ago

how to install code server on windows

yekanchi commented 1 year ago

how to install code server on windows

use npm , it just works like a charm in windows 11 on nodejs 16.20.2

suhrob008 commented 1 year ago

yes