code-server icon indicating copy to clipboard operation
code-server copied to clipboard

Support and publish Windows release

Open nhooyr opened this issue 4 years ago • 57 comments

  • [ ] Should be able to build on Windows
  • [ ] See linked issues, make sure they work
  • [ ] Publish Windows releases as part of CI

nhooyr avatar Mar 05 '20 15:03 nhooyr

@nhooyr Any updates? Does 3.0 release support Windows?

danny-laa avatar May 01 '20 15:05 danny-laa

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

nhooyr avatar May 01 '20 16:05 nhooyr

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.

max-hk avatar May 02 '20 05:05 max-hk

@maxloh Awesome thanks for looking into it!

nhooyr avatar May 03 '20 19:05 nhooyr

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 avatar May 06 '20 23:05 nhooyr

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

nhooyr avatar May 13 '20 00:05 nhooyr

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

nhooyr avatar May 13 '20 08:05 nhooyr

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

nhooyr avatar May 18 '20 00:05 nhooyr

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

EriKWDev avatar Jul 12 '20 14:07 EriKWDev

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 avatar Sep 29 '20 19:09 fearthecowboy

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.

fearthecowboy avatar Sep 29 '20 19:09 fearthecowboy

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

code-asher avatar Sep 29 '20 20:09 code-asher

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:\...)

fearthecowboy avatar Sep 30 '20 16:09 fearthecowboy

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

code-asher avatar Sep 30 '20 16:09 code-asher

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

Suggested steps to improve Windows support

  • [ ] fix npm/yarn's postinstall.sh to run automatically on Windows (currently opens an awkward prompt, or doesn't run at all)
  • [ ] create windows builds for releases
  • [ ] .msi Installer for code-server for releases
  • [ ] publish Windows release for cloud-agent (details & workaround: cdr/cloud-agent#17)

bpmct avatar Aug 22 '21 16:08 bpmct

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

bpmct avatar Aug 22 '21 17:08 bpmct

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

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `./postinstall.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 avatar Sep 01 '21 17:09 max-hk

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.

max-hk avatar Sep 01 '21 18:09 max-hk

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

locdhthtb avatar Sep 01 '21 18:09 locdhthtb

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?

bpmct avatar Sep 01 '21 18:09 bpmct

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.

max-hk avatar Sep 01 '21 19:09 max-hk

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; ^

locdhthtb avatar Sep 02 '21 11:09 locdhthtb

@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?

max-hk avatar Sep 02 '21 12:09 max-hk

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

uninstall code-server from npm

  • remove folder C/document/user..../.code-server (npm)
  • installl yarn
  • yarn add global code-server
  • powershell > code-server
  • it's working perfect

locdhthtb avatar Sep 02 '21 14:09 locdhthtb

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

max-hk avatar Sep 04 '21 14:09 max-hk

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). """
  1. When I open a markdown file, I could not open the preview to the side.
  2. My terminal for running code-server always show image

QuYue avatar Sep 06 '21 09:09 QuYue

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\

max-hk avatar Sep 06 '21 09:09 max-hk

@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 avatar Sep 06 '21 11:09 QuYue

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

QuYue avatar Sep 06 '21 14:09 QuYue

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

max-hk avatar Sep 06 '21 14:09 max-hk