Discourse Ember CLI 代理错误

Discourse Ember CLI 代理错误

FetchError: request to http://127.0.0.1:3000/ failed, reason: connect ECONNREFUSED 127.0.0.1:3000
    at ClientRequest. (file:///home/xxx/discourse/node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/index.js:108:11)
    at ClientRequest.emit (node:events:524:28)
    at emitErrorEvent (node:_http_client:101:11)
    at Socket.socketErrorListener (node:_http_client:504:5)
    at Socket.emit (node:events:524:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

如何修复此错误?

谢谢

这是标准安装吗?开发安装吗?

请遵循指南 Install Discourse on Ubuntu or Debian for Development

您需要运行 rails 服务器。

1 个赞

请详细说明您做了什么。您是否启动了 Rails?

1 个赞

I, [2025-07-22T11:01:04.131140 #169405] INFO – : listening on addr=127.0.0.1:3000 fd=28
[ember-cli] …[@embroider/webpack]
#<Thread:0x00007f3f66f43c18 /home/xxx/discourse/lib/discourse.rb:1189 run> terminated with exception (report_on_exception is true):
/home/xxx/discourse/lib/letter_avatar.rb:112:in ‘Kernel#': No such file or directory - magick (Errno::ENOENT) from /home/xxx/discourse/lib/letter_avatar.rb:112:in 'LetterAvatar.image_magick_version' from /home/xxx/discourse/lib/discourse.rb:1189:in 'block in Discourse.preload_rails!' E, [2025-07-22T11:01:14.236992 #169405] ERROR -- : No such file or directory - magick (Errno::ENOENT) /home/xxx/discourse/lib/letter_avatar.rb:112:in 'Kernel#
/home/xxx/discourse/lib/letter_avatar.rb:112:in ‘LetterAvatar.image_magick_version’
/home/xxx/discourse/lib/discourse.rb:1189:in ‘block in Discourse.preload_rails!’
[bin/ember-cli] unicorn process stopped. Terminating ember-cli.

你做了类似这样的事情吗?

cd ~/discourse
./bin/rails -c

或者

cd ~/discourse
bin/rails -u

确保安装了正确版本的 imagemagick。

2 个赞

看起来是个好建议。这是我的做法。它假设你已经安装了 asdf 和 docker。

  IMAGE_MAGICK_VERSION=$(docker run discourse/base:release bash -c 'magick --version'|head -1|cut -d' ' -f3)
  echo "Got IMAGE_MAGICK_VERSION: $IMAGE_MAGICK_VERSION"
  asdf install imagemagick $IMAGE_MAGICK_VERSION 2>&1 |grep -v "already"
  echo "installed imagemagic, now set global"
  asdf global imagemagick $IMAGE_MAGICK_VERSION 2>&1 |grep -v "already"
  echo "global done."
1 个赞