2016-02-01 47 views
1

我從其官方庫中安裝parsoid,並通過將我的Mediawiki API添加到/etc/mediawiki/parsoid/settings.js來正確配置它。我還從我的/usr/lib/parsoid/src/api/localsettings.js文件中刪除了Interwiki選項,因爲它們似乎被settings.js文件中的parsoidConfig.setMwApi選項所取代。Parsoid不啓動

從命令PROMT運行nodejs /usr/lib/parsoid/src/api/server.js,我收到以下錯誤信息:

[fatal][worker][4915] uncaught exception object is not a function 
TypeError: object is not a function 
    at new ParsoidService (/usr/lib/parsoid/src/api/ParsoidService.js:43:12) 
    at Object.<anonymous> (/usr/lib/parsoid/src/api/server.js:203: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 
[warning][master][4882] worker 4911 died (1), restarting. 

當我運行service parsoid startservice parsoid status我總是得到信息,沒有parsoid進程在運行。

有人可以解釋我爲什麼Parsoid不起作用嗎?

編輯:

localsettings.js

/* 
* This is a sample configuration file. 
* 
* Copy this file to localsettings.js and edit that file to fit your needs. 
* 
* Also see the file ParserService.js for more information. 
*/ 

exports.setup = function(parsoidConfig) { 
    // The URL here is supposed to be your MediaWiki installation root 
    //parsoidConfig.setInterwiki('localhost', 'http://domain.com/Wiki/api.php'); 
    //parsoidConfig.setInterwiki('foo', 'http://localhost/wikiarst/api.php'); 
    //parsoidConfig.setInterwiki('noconn', 'http://213.127.84.12:80/wikiarst/api.php'); 
    //parsoidConfig.setInterwiki('disney', 'http://disneychannel.wikia.com/api.php'); 

    // Use the PHP preprocessor to expand templates via the MW API (default true) 
    //parsoidConfig.usePHPPreProcessor = true; 

    // Use selective serialization (default false) 
    parsoidConfig.useSelser = true; 

    // parsoid cache url 
    //parsoidConfig.parsoidCacheURI = 'http://localhost:8000/'; 

    //parsoidConfig.trace = true; 
    //parsoidConfig.traceFlags = 'selser,wts'; 
    //parsoidConfig.traceFlags = 'selser'; 

    //parsoidConfig.defaultAPIProxyURI = 'http://localhost/'; 

}; 


/* vim: set filetype=javascript noexpandtab ts=4 sw=4 cindent : */ 

settings.js

/* 
* This is a sample configuration file. 
* 
* Copy this file to localsettings.js and edit that file to fit your needs. 
* 
* Also see: 
* - api/server.js for more information about passing config files via 
* the commandline. 
* - lib/mediawiki.ParsoidConfig.js all the properties 
* that you can configure here. Not all properties are 
* documented here. 
*/ 
'use strict'; 

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({ prefix: 'localhost', uri: 'http://domain.com/Wiki/api.php' }); 
    // To specify a proxy (or proxy headers) specific to this prefix (which 
    // overrides defaultAPIProxyURI) use: 
    /* 
    parsoidConfig.setMwApi({ 
     prefix: '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 
     } 
    }); 
    */ 

    // We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly 
    // for other projects: 'enwiktionary', 'enwikiquote', 'enwikibooks', 
    // 'enwikivoyage' etc. (default true) 
    //parsoidConfig.loadWMF = false; 

    // A default proxy to connect to the API endpoints. 
    // Default: undefined (no proxying). 
    // Overridden by per-wiki proxy config in setMwApi. 
    //parsoidConfig.defaultAPIProxyURI = 'http://proxy.example.org:8080'; 

    // Enable debug mode (prints extra debugging messages) 
    //parsoidConfig.debug = true; 

    // Use the PHP preprocessor to expand templates via the MW API (default true) 
    //parsoidConfig.usePHPPreProcessor = false; 

    // Use selective serialization (default false) 
    parsoidConfig.useSelser = true; 

    // Allow cross-domain requests to the API (default '*') 
    // Sets Access-Control-Allow-Origin header 
    // disable: 
    //parsoidConfig.allowCORS = false; 
    // restrict: 
    //parsoidConfig.allowCORS = 'some.domain.org'; 

    // Set to true for using the default performance metrics reporting to statsd 
    // If true, provide the statsd host/port values 
    /* 
    parsoidConfig.useDefaultPerformanceTimer = true; 
    parsoidConfig.txstatsdHost = 'statsd.domain.org'; 
    parsoidConfig.txstatsdPort = 8125; 
    */ 

    // Alternatively, define performanceTimer as follows: 
    /* 
    parsoidConfig.performanceTimer = { 
     timing: function(metricName, time) { }, // do-something-with-it 
     count: function(metricName, value) { }, // do-something-with-it 
    }; 
    */ 

    // How often should we emit a heap sample? Time in ms. 
    // This setting is only relevant if you have enabled 
    // performance monitoring either via the default metrics 
    // OR by defining your own performanceTimer properties 
    //parsoidConfig.heapUsageSampleInterval = 5 * 60 * 1000; 

    // Allow override of port/interface: 
    //parsoidConfig.serverPort = 8000; 
    //parsoidConfig.serverInterface = '127.0.0.1'; 

    // The URL of your LintBridge API endpoint 
    //parsoidConfig.linterAPI = 'http://lintbridge.wmflabs.org/add'; 

    // Require SSL certificates to be valid (default true) 
    // Set to false when using self-signed SSL certificates 
    //parsoidConfig.strictSSL = false; 

    // Use a different server for CSS style modules. 
    // Set to true to use bits.wikimedia.org, or to a string with the URI. 
    // Leaving it undefined (the default) will use the same URI as the MW API, 
    // changing api.php for load.php. 
    //parsoidConfig.modulesLoadURI = true; 

    // Suppress some warnings from the Mediawiki API 
    // (defaults to suppressing warnings which the Parsoid team knows to 
    // be harmless) 
    //parsoidConfig.suppressMwApiWarnings = /annoying warning|other warning/; 
}; 

回答

0

看來你/etc/mediawiki/parsoid/settings.js和或/usr/lib/parsoid/src/api/localsettings.js被打破,Parsoid是因爲它試圖儘快崩潰看看你的parsoidConfig。我建議您仔細閱讀https://www.mediawiki.org/wiki/Parsoid/Setup#Configuration的說明,如果您仍然遇到問題,請張貼設置文件的摘錄。

+0

感謝您的支持。我完全按照指南中的說明完成了設置,並編輯了這兩個文件,以便它們指向我的MW API。 –

+0

好吧,它看起來像你的Parsoid崩潰在下面一行:'var app = express();'來自'var express = require('express');'在文件頂部。 parsoid包與適當版本的express捆綁在一起,但是您可能安裝了相沖突的版本? 'dpkg -l'*表示*''說什麼? – cscott

+0

輸出:「dpkg-query:找不到匹配* express *的包*」 也許它沒有安裝?我也看了一下deb文件,但似乎沒有像express這樣的應用程序。 –