MediaWiki - VisualEditor Extension: (curl error: 28) Timeout was reached

MediaWiki - VisualEditor Extension: (curl error: 28) Timeout was reached

我在尝试借助 Visual Editor 编辑页面时显示以下错误(之前还没有用):

Error loading data from server: apierror-visualeditor-docserver-http-error: (curl error: 28) Timeout was reached. Would you like to retry?

我认为以上是端口问题,因为在我执行命令时由于某些奇怪的原因无法访问端口 8142:

curl -L http://40.68.204.191:8142

并收到以下回复:

curl: (7) Failed to connect to 40.68.204.191 port 8142: Connection timed out

我通过执行以下操作安装了可视化编辑器扩展:

  1. ExtensionDistributor 页面下载可视化编辑器。得到代码后,我将其保存到我的wiki的/opt/bitnami/apps/mediawiki/htdocs/extensions/VisualEditor目录中。

    我已经安装了 1.32 版本(最新稳定的 MediaWiki)

  2. 我已经按照此处的安装说明安装了 Parsoid:https://www.mediawiki.org/wiki/Parsoid/Setup

  3. 我已将以下代码添加到我的 LocalSettings.php 文件中:

    wfLoadExtension( 'VisualEditor' );
    

    ##### VisualEditor Config #####
    
    // Enable by default for everybody
    
    $wgDefaultUserOptions['visualeditor-enable'] = 1;
    
    // Optional: Set VisualEditor as the default for anonymous users
    
    // otherwise they will have to switch to VE
    
    $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
    
    // Don't allow users to disable it
    
    $wgHiddenPrefs[] = 'visualeditor-enable';
    
    // OPTIONAL: Enable VisualEditor's experimental code features
    
    #$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
    
    $wgVirtualRestConfig['modules']['parsoid'] = array(
    
        // URL to the Parsoid instance
    
        // Use port 8142 if you use the Debian package
    
        'url' => 'http://40.68.204.191:8142',
    
        // Parsoid "domain", see below (optional)
    
        'domain' => '40.68.204.191',
    
        // Parsoid "prefix", see below (optional)
    
        'prefix' => '40.68.204.191'
    
    );
    
  4. 我更改了 config.yaml 文件(用于 Parsoid 配置)中的两行代码,可以在我的虚拟机上的“/etc/mediawiki/parsoid”文件夹中找到:

    # Configure Parsoid to point to your MediaWiki instances.
    
            mwApis:
    
            - # This is the only required parameter,
    
              # the URL of you MediaWiki API endpoint.
    
             
    
              #  uri: 'http://localhost/api.php'
    
              uri: 'http://40.68.204.191/w/api.php'
    
              # before >>  uri: 'http://localhost/w/api.php'
    
              # The "domain" is used for communication with Visual Editor
    
              # and RESTBase.  It defaults to the hostname portion of
    
              # the `uri` property below, but you can manually set it
    
              # to an arbitrary string.
    
             
    
              # domain: 'localhost'  # optional
    
              domain: '40.68.204.191'  # optional
    
              # before >> domain: 'localhost'  # optional
    
  5. 我还在 /etc/selinux 文件夹中的 semanage.conf 文件末尾添加了 SELINUX=permissive

我已按照以下说明安装 Parsoid 和 VisualEditor:

https://www.mediawiki.org/wiki/Parsoid/Setup

https://www.mediawiki.org/wiki/Extension:VisualEditor

VisualEditor 和 Parsoid 是我在 MediaWiki 上安装的新扩展。

下图包含我在尝试使用可视化编辑器时显示在我的 wiki 上的错误:

下面显示了尝试导航到 http://40.68.204.191:8142/ 后的 Chrome 错误:

下面显示了我在 Google Chrome 中导航到 w/api.php 后的结果:

下面显示了尝试导航到 http://40.68.204.191:8000/ 后的 Chrome 错误: enter image description here

执行命令 netstat -plantu 后显示以下内容: enter image description here

我试过这个:sudo lsof -i -n -P | grep LISTEN 得到的结果是: enter image description here

以下内容包含在/var/log/parsoid/parsoid.log

{"name":"parsoid","hostname":"MediaWiki","pid":20623,"level":30,"levelPath":"info/service-runner","msg":"master(20623) initializing 1 workers","time":"2019-02-11T17:17:27.490Z","v":0}

{"name":"parsoid","hostname":"MediaWiki","pid":20644,"level":60,"moduleName":"../src/lib/index.js","levelPath":"fatal/service-runner/worker","msg":"Unexpected token {","time":"2019-02-11T17 :17:29.061Z","v":0} {"name":"parsoid","hostname":"MediaWiki","pid":20623,"level":40,"message":"first worker died during startup, continue startup","worker_pid":20644,"exit_code":1,"startup_attempt":1,"levelPath":"warn/service-runner/master","msg":"first worker died during startup, continue startup" ,"time":"2019-02-11T17:17:30.091Z","v":0} 被杀 {"name":"parsoid","hostname":"MediaWiki","pid":22289,"level":30,"levelPath":"info/service-runner","msg":"master(22289) initializing 1 workers","time":"2019-02-11T17:43:47.240Z","v":0} {"name":"parsoid","hostname":"MediaWiki","pid":22298,"level":60,"moduleName":.. /src/lib/index.js","levelPath":"fatal/service-runner/worker","msg":"Unexpected token {","time":"2019-02-11T17:43:48.803Z ","v":0} {"name":"parsoid","hostname":"MediaWiki","pid":22289,"level":40,"message":"first worker died during startup, continue startup","worker_pid":22298,"exit_code":1,"startup_attempt":1,"levelPath":"warn/service-runner/master","msg":"first worker died during startup, continue startup" ,"time":"2019-02-11T17:43:49.815Z","v":0} 被杀 {"name":"parsoid","hostname":"MediaWiki","pid":14815,"level":30,"levelPath":"info/service-runner","msg":"master(14815) initializing 1 workers","time":"2019-02-14T20:49:48.472Z","v":0} {"name":"parsoid","hostname":"MediaWiki","pid":14829,"level":60,"moduleName":.. /src/lib/index.js","levelPath":"fatal/service-runner/worker","msg":"Unexpected token {","time":"2019-02-14T20:49:50.113Z ","v":0} {"name":"parsoid","hostname":"MediaWiki","pid":14815,"level":40,"message":"first worker died during startup, continue startup","worker_pid":14829,"exit_code":1,"startup_attempt":1,"levelPath":"warn/service-runner/master","msg":"first worker died during startup, continue startup" ,"time":"2019-02-14T20:49:51.131Z","v":0}

您的节点应该是 运行 Parsoid 0.9.0 版本 6 或更高版本,以检查此 运行:

node -v

如果它不是至少版本 6,请尝试更新节点,您应该可以通过以下方式做到这一点:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

尝试将 Config.yamlLocalSettings.php 中的地址更改为 localhost

如果您得到 HTTP:401,请按照说明进行操作 here