你好!我正在尝试在我的 Windows 11 机器上设置一个本地的 Discourse 实例,以便在 WSL 中进行开发。
首先,我想说我同时也是 Discourse、Ubuntu 和 WSL 的新手。所以这些错误显然是我的问题。请帮帮我!![]()
上面是我遵循的指南。
我已经尝试了第四次,但仍然遇到相同的错误。我将详细介绍安装过程。
首先,我确保安装了 Windows Subsystem for Linux 2。该指南建议使用 Ubuntu 18.04,所以我尝试了它。在那之后没有成功,我又尝试了 22.04,但仍然没有结果。在本指南中,我将使用 18.04 来展示错误。
第一步是使用以下命令安装软件包:
<(wget -qO- https://raw.githubusercontent.com/discourse/install-rails/master/linux)
这工作正常。唯一看起来有点奇怪的是这个:
createuser: could not connect to database template1: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
failed
在设置数据库之前,您必须使用以下命令手动启动 PostgreSQL 服务和 Redis 服务器
sudo service postgresql start
redis-server --daemonize yes
第一个命令运行得非常好,第二个命令已经出现问题:
redis-server --daemonize yes
Command ‘redis-server’ not found, but can be installed with:
sudo apt install redis-server
没关系。我运行
sudo apt install redis-server
然后再次尝试。
这次,它运行得很棒!
- 克隆 Discourse 仓库
git clone https://github.com/discourse/discourse.git ~/discourse
这里没有问题。
使用以下命令设置数据库:
sudo -u postgres createuser -s "$USER"
4. 这是关键部分
cd ~/discourse
source ~/.bashrc
bundle install
错误:
Command ‘bundle’ not found, but can be installed with:
sudo apt install ruby-bundler
让我们运行它。安装完成后,再次运行
bundle install
在 Discourse 目录中。
Error: You must use Bundler 2 or greater with this lockfile.
之后,在尝试安装 Bundler 时:
ERROR: Error installing bundler: There are no versions of bundler (= 2.4.17) compatible with your Ruby & RubyGems bundler requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.
好的,也许我需要使用 rbenv 更新我的 Ruby:
rbenv install 2.6.0
ruby-build: definition not found: 2.6.0See all available versions with `rbenv install --list’.
If the version you need is missing, try upgrading ruby-build.
当检查 rbenv install --list 时,它在 2.5.0 处停止,我似乎无法更新 rbenv。
有人能给我一些关于我可能做错了什么的提示吗?我似乎无法在第 4 步之后继续前进。
非常感谢!