googlecreativelab / coder

A simple way to make web stuff on Raspberry Pi
http://goo.gl/coder
Apache License 2.0
2.42k stars 275 forks source link

Is it possible to run Coder on windows? #120

Open ghost opened 5 years ago

ghost commented 5 years ago

I was wondering if you could run coder on windows, I looked at some of the code on windows, and the directories i found it pointing to were nonexistent within the folders. (I'm talking about the example/project page). The projects themselves seem to be structured strangely, for html, and I was wondering whether it is possible to get the editor to work on windows. Thank you in advance.

grind3d commented 2 years ago

Yes, you can run it on Windows. You need to get NodeJS for windows, but this was built ages ago (on Node 0.10.7) and won't run on most versions.

If you get the installer for Windows NodeJS 0.10.7 you will get strange errors when trying to run coder. I use v5.12.0 personally, because I know it does work with coder.

Install NodeJS from the MSI package, then you need to put coder together the way their scripts normally do on linux.

\coder-base\ is your main folder \coder-apps\common\ has all the apps, but the structure needs to be moved under coder-base in a certain way.

Go into \coder-apps\common. Each of the folders here has files the need to be moved. I'll use \coder-apps\common\auth\ as the example, all of the folders files need to be moved in the same way as this. Files go from the first folder into the second \coder-apps\common\auth\app* > \coder-base\apps\auth* (see how you're moving files from \auth\app\ to \apps\auth\, this flipping of folder structure will continue for everything) \coder-apps\common\auth\static* > \coder-base\static\apps\auth* \coder-apps\common\auth\views* > \coder-base\views\apps\auth*

You need to do this for the boilerplate, coder, coderlib, editor, eyeball, game2d, hello_coder, and spacerocks folders too. Now replace \coder-base\config.js with config.js.localhost

Once you've put all the file together open "Node.js command prompt" from your start menu. Go to your \coder-base\ folder and run "npm install" to let it prepare dependencies (one time thing). You may get CERT_UNTRUSTED errors because the version of Node is old. I'm not sure if it's a cert in Node, or if it doesn't have the destination server's cert in it's cert store, but the workaround is to run "npm config set strict-ssl false" then try "npm install" again. Then run "node localserver.js" from that folder anytime you want to start the server. In your browser go to http://127.0.0.1:8080 and coder should be running.

NOTE: This mostly applies to running it on a modern Linux server too, you need an older version of NodeJS, but not so old that it doesn't understand the syntax in the dependencies. I used v5.12.0 on Windows because that's what I used when I got it working on Ubuntu in the past. If you're using Linux you don't need to do that file moving manually, there are .sh scripts in \coder-apps\ to do it for you.