0

我有来自 mediawiki 的 parsoid 0.4.0,nodejs v0.10.25,当我 /etc/init.d/parsoid 启动时,我收到重新启动的工作人员,在 parsoid.log 中有下一条消息,此消息无限期地重复,使我的 parsoid。日志无限增长,另一方面,我在http://localhost:8142没有收到任何响应,8142 是我的 parsoid 说的服务端口,当我以“/etc/init.d/parsoid 开头时输出消息:

root@vscj016mlinuxserver:/usr/lib# /etc/init.d/parsoid start
Started Parsoid server on port 8142
root@vscj016mlinuxserver:/usr/lib#

/var/log/parsoid.log 输出:

[info][master][13876] initializing 4 workers
[info][worker][13879] loading ...
[info][worker][13882] loading ...
[info][worker][13878] loading ...
[info][worker][13881] loading ...
[fatal][worker][13879] uncaught exception Object function     createApplication() {
var app = function(req, res, next) {
app.handle(req, res, next);
};

mixin(app, EventEmitter.prototype, false);
mixin(app, proto, false);

app.request = { __proto__: req, app: app };
app.response = { __proto__: res, app: app };
app.init();
return app;
} has no method 'createServer'
TypeError: Object function createApplication() {
var app = function(req, res, next) {
app.handle(req, res, next);
};

mixin(app, EventEmitter.prototype, false);
mixin(app, proto, false);

app.request = { __proto__: req, app: app };
app.response = { __proto__: res, app: app };
app.init();
return app;
} has no method 'createServer'
at new ParsoidService (/usr/lib/parsoid/src/api/ParsoidService.js:23:20)
at Object.<anonymous> (/usr/lib/parsoid/src/api/server.js:202:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3

另一方面,我可以看到以“ps -ef | grep parsoid”开头的进程,进程的 pid 每次都会发生变化,如下一个输出所示:

parsoid    920     1  0 09:08 ?        00:00:00 /bin/sh -c /usr/bin/nodejs             /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js >>         /var/log/parsoid/parsoid.log 2>&1
parsoid    949   920  0 09:08 ?        00:00:01 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2563   949 18 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2565   949 19 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2567   949 17 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2569   949  5 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
root      2572  2134  0 09:13 pts/0    00:00:00 grep --color=auto parsoid
root@vscj016mlinuxserver:/var/log/parsoid# ps -ef| grep parsoid
parsoid    920     1  0 09:08 ?        00:00:00 /bin/sh -c /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js >>     /var/log/parsoid/parsoid.log 2>&1
parsoid    949   920  0 09:08 ?        00:00:01 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2579   949 23 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2581   949 23 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2583   949  0 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2585   949  0 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
root      2588  2134  0 09:13 pts/0    00:00:00 grep --color=auto parsoid
root@vscj016mlinuxserver:/var/log/parsoid# ps -ef| grep parsoid
parsoid    920     1  0 09:08 ?        00:00:00 /bin/sh -c /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js >>     /var/log/parsoid/parsoid.log 2>&1
parsoid    949   920  0 09:08 ?        00:00:01 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2581   949 22 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2583   949 30 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2585   949 28 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js
parsoid   2589   949 15 09:13 ?        00:00:00 /usr/bin/nodejs     /usr/lib/parsoid/src/api/server.js -c /etc/mediawiki/parsoid/settings.js

我也展示了 /etc/mediawiki/parsoid/settings.js:

exports.setup = function(parsoidConfig) {
    // Set your own user-agent string
    // Otherwise, defaults to "Parsoid/<current-version-defined-in-    package.json>"
    //parsoidConfig.userAgent = "My-User-Agent-String";

    // The URL of your MediaWiki API endpoint.
    parsoidConfig.setMwApi('localhost', {uri:     'http://localhost/mediawiki/api.php'} );
    // To specify a proxy (or proxy headers) specific to this prefix (which
    // overrides defaultAPIProxyURI) use:
    /*
    parsoidConfig.setMwApi('localhost', {
            uri: 'http://localhost/w/api.php',
            // set `proxy` to `null` to override and force no proxying.
            proxy: {
                    uri: 'http://my.proxy:1234/',
                    headers: { 'X-Forwarded-Proto': 'https' } // headers are     optional
            }
    });
    */
......
......
......

在这里,我显示了安装的数据包和我的 ubuntu 服务器的版本:

root@vscj016mlinuxserver:/usr/lib# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:        14.04
Codename:       trusty
root@vscj016mlinuxserver:/usr/lib#
root@vscj016mlinuxserver:/usr/lib#
root@vscj016mlinuxserver:/usr/lib# dpkg -l parsoid
Deseado=Desconocido/Instalar/Eliminar/Purgar/Retener
| Estado=No/Instalado/Config-files/Desempaquetado/Medio-conf/Medio-    inst/espera-disparo/pendiente-disparo
|/ Err?=(ninguno)/Requiere-reinst (Estado,Err: mayúsc.=malo)
||/ Nombre                            Versión               Arquitectura              Descripción
+++-=================================-=====================-        =====================-    =======================================================================
ii  parsoid                           0.4.0                 amd64                     Web service converting HTML+RDFa to MediaWiki wikitext and back
root@vscj016mlinuxserver:/usr/lib# dpkg -l nodejs
Deseado=Desconocido/Instalar/Eliminar/Purgar/Retener
| Estado=No/Instalado/Config-files/Desempaquetado/Medio-conf/Medio-    inst/espera-disparo/pendiente-disparo
|/ Err?=(ninguno)/Requiere-reinst (Estado,Err: mayúsc.=malo)
||/ Nombre                            Versión               Arquitectura              Descripción
+++-=================================-=====================-    =====================-    =======================================================================
ii  nodejs                            0.10.25~dfsg2-2ubuntu amd64                     evented I/O for V8 javascript
root@vscj016mlinuxserver:/usr/lib# dpkg -l nodejs-legacy
Deseado=Desconocido/Instalar/Eliminar/Purgar/Retener
| Estado=No/Instalado/Config-files/Desempaquetado/Medio-conf/Medio-    inst/espera-disparo/pendiente-disparo
|/ Err?=(ninguno)/Requiere-reinst (Estado,Err: mayúsc.=malo)
||/ Nombre                            Versión               Arquitectura                  Descripción
+++-=================================-=====================-        =====================-        =======================================================================
ii  nodejs-legacy                     0.10.25~dfsg2-2ubuntu all                            evented I/O for V8 javascript (legacy symlink)
root@vscj016mlinuxserver:/usr/lib#
4

3 回答 3

0
this my /etc/mediawiki/parsoid configuration:

exports.setup = function(parsoidConfig) {
    // Set your own user-agent string
    // Otherwise, defaults to "Parsoid/<current-version-defined-in-    package.json>"
    //parsoidConfig.userAgent = "My-User-Agent-String";

    // The URL of your MediaWiki API endpoint.
    parsoidConfig.setMwApi('localhost', { uri: 'http://localhost/mediawiki/api.php' });
    // To specify a proxy (or proxy headers) specific to this prefix (which
    // overrides defaultAPIProxyURI) use:
    /*
    parsoidConfig.setMwApi('localhost', {
            uri: 'http://localhost/w/api.php',
            // set `proxy` to `null` to override and force no proxying.
            proxy: {
                    uri: 'http://my.proxy:1234/',
                    headers: { 'X-Forwarded-Proto': 'https' } // headers are optional
            }
    });
    */
于 2016-05-27T08:08:25.450 回答
0

这是我的parsoid配置,我不知道这是不是问题:

exports.setup = function(parsoidConfig) {
    // Set your own user-agent string
    // Otherwise, defaults to "Parsoid/<current-version-defined-in-    package.json>"
    //parsoidConfig.userAgent = "My-User-Agent-String";

    // The URL of your MediaWiki API endpoint.
    parsoidConfig.setMwApi('localhost', {     uri: 'http://localhost/mediawiki/api.php' });
    // To specify a proxy (or proxy headers) specific to this prefix (which
    // overrides defaultAPIProxyURI) use:
    /*
    parsoidConfig.setMwApi('localhost', {
            uri: 'http://localhost/w/api.php',
            // set `proxy` to `null` to override and force no proxying.
            proxy: {
                    uri: 'http://my.proxy:1234/',
                    headers: { 'X-Forwarded-Proto': 'https' } // headers     are optional
            }
    });
    */
于 2016-05-27T07:55:42.997 回答
0

使用更新版本的 Node,例如 >=4.3,您将有更好的时间。您可以使用 NVM 运行管理不同版本的 Node:https ://github.com/creationix/nvm

于 2016-05-25T11:53:58.037 回答