我正在尝试使用 Handlebars,并得到一个不知疲倦的错误。尝试了本地安装和全局安装。
$ sudo npm install -g handlebars
$ handlebars
/usr/local/lib/node_modules/handlebars/lib/handlebars/base.js:8
Handlebars.VERSION = "1.0.beta.5";
^
ReferenceError: Handlebars is not defined
at /usr/local/lib/node_modules/handlebars/lib/handlebars/base.js:8:1
at Object.<anonymous> (/usr/local/lib/node_modules/handlebars/lib/handlebars/base.js:100:1)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object.<anonymous> (/usr/local/lib/node_modules/handlebars/lib/handlebars.js:1:80)
at Module._compile (module.js:446:26)
其他一些有用的信息:
$ node --version
v0.6.19
$ npm --version
1.1.24
我还尝试编辑文件 handlebars/base.js。我将第一行更改为阅读
Handlebars = this.Handlebars = {}
这暂时消除了我收到的第一个错误。但是随后弹出了一个错误:
$ handlebars
module.js:337
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module './parser'
at Function._resolveFilename (module.js:337:11)
at Function._load (module.js:279:25)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object.<anonymous> (/usr/local/lib/node_modules/handlebars/lib/handlebars/compiler/base.js:1:80)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
是否还有其他人在安装 Handlebars 时遇到问题,或者有关于如何启动和运行安装的建议?