Beginners Guide to Install Discourse on Windows 10 for Development

check your wsl version from a powershell prompt. If it version 1, upgrade to version 2:

PS C:\Windows\system32> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Running         1
PS C:\Windows\system32> wsl --set-version ubuntu 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Conversion complete.
PS C:\Windows\system32> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Stopped         2
4 Likes

Okay, so just as an FYI, the way you install WSL has changed in Windows 11.

5 Likes

The instructions above got me most of the way there, but I think there were a few important points that were missed.

Running in the development environment requires the use of ember-cli.

The Ubuntu 18.04 LTS distribution used along with WSL2 does not come packaged with node 14 and ember-cli complains with the prepackaged node version of 10.something. I had to update node which google was kind enough to provide the instructions for.

curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt -y install nodejs

node -v verified the proper version.

Once I was able to get ember-cli to run properly, you still need to run the rails server itself alongside ember-cli. So I have two terminals open, one running bin/ember-cli the other running bin/rails s

Edited:

I could not get a plugin to work properly using ember-cli. It would continually fail with

I presume that has something to do with ember-cli and how it’s packaging, or not, files in plugin directories?

I did discover that I could bypass ember-cli entirely by setting NO_EMBER_CLI=1 in the environment. Once I did that, the plugin started working correctly. And you no longer have to run ember-cli and proxy over to the rails server.

Is there something special, or something broken, regarding the interplay of plugins and ember-cli?

3 Likes

Thank you so much for posting this!

This is sweet. Out of the box I had a Bundler::GemNotFound problem, but after installing

nokogiri
mini-portile2
libv8-node

And rerunning bundle update

I magically have a discourse server running within VS Code.

4 Likes

Thanks for this. Due to some cognitive dissonance I had assumed Windows 11 would have WSL2 installed … my shock to discover I still have WSL1 on one machine that I’d upgraded to 11!

4 Likes

Not that I’m aware of, I’ve been developing plugins with ember-cli for some time. Best take that up with the specific plugin author.

2 Likes

Lol I’m already lost at the first step. I’ve typed inside my command prompt on Windows 10:

bash <(wget -qO- https://raw.githubusercontent.com/techAPJ/install-rails/master/linux)

But it gives me this error: The system cannot find the file specified.

1 Like

At the start of the instructions did you read

You can do it easily using Windows Subsystem for Linux feature.


EDIT

I just ran the command successfully, although it took about 20 minutes for it all to complete. As the instructions note WSL 2 must be installed. :slightly_smiling_face:

4 Likes