hexo 报错没有init方法
版本是3.1.1
我是用pm2去运行hexo发现老是报错
启动文件内容是
// app.js
require('hexo').init({command: 'server -p 9000'});
node app.js
报没有init方法。
TypeError: Object function Hexo(base, args){
base = base || process.cwd();
args = args || {};
EventEmitter.call(this);
this.base_dir = base + sep;
this.public_dir = pathFn.join(base, 'public') + sep;
this.source_dir = pathFn.join(base, 'source') + sep;
this.plugin_dir = pathFn.join(base, 'node_modules') + sep;
this.script_dir = pathFn.join(base, 'scripts') + sep;
this.scaffold_dir = pathFn.join(base, 'scaffolds') + sep;
this.theme_dir = pathFn.join(base, 'themes', defaultConfig.theme) + sep;
this.theme_script_dir = pathFn.join(this.theme_dir, 'scripts') + sep;
this.env = {
args: args,
debug: Boolean(args.debug),
safe: Boolean(args.safe),
silent: Boolean(args.silent),
env: process.env.NODE_ENV || 'development',
version: pkg.version,
init: false
};
this.config_path = args.config ? pathFn.resolve(base, args.config)
: pathFn.join(base, '_config.yml');
this.extend = {
console: new extend.Console(),
deployer: new extend.Deployer(),
filter: new extend.Filter(),
generator: new extend.Generator(),
helper: new extend.Helper(),
migrator: new extend.Migrator(),
processor: new extend.Processor(),
renderer: new extend.Renderer(),
tag: new extend.Tag()
};
this.config = _.clone(defaultConfig);
this.log = createLogger(this.env);
this.render = new Render(this);
this.route = new Router();
this.post = new Post(this);
this.scaffold = new Scaffold(this);
this._dbLoaded = false;
this._isGenerating = false;
this.database = new Database({
version: dbVersion,
path: pathFn.join(base, 'db.json')
});
registerModels(this);
this.source = new Source(this);
this.theme = new Theme(this);
this.locals = new Locals(this);
this._bindLocals();
} has no method 'init'
at repl:1:17
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface.<anonymous> (repl.js:239:12)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
at ReadStream.EventEmitter.emit (events.js:98:17)
at emitKey (readline.js:1095:12)
at readline.js:1080:7
at String.forEach (native)
at emitKey (readline.js:1079:29)
at ReadStream.onData (readline.js:840:14)
求助
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论