我想爲服務器端JavaScript使用一些功能。我認爲原型是檢查瀏覽器類型,但當然node.js不是瀏覽器。我得到以下錯誤:如何在Node.js中使用Prototype.js?
$ node
> require('./prototype') ;
ReferenceError: navigator is not defined
at /home/guest/projects/javascript/prototype.js:14:5
at Object.<anonymous> (/home/guest/projects/javascript/prototype.js:23:4)
at Module._compile (node.js:462:23)
at Module._loadScriptSync (node.js:469:10)
at Module.loadSync (node.js:338:12)
at loadModule (node.js:283:14)
at require (node.js:411:14)
at cwdRequire (repl:29:10)
at [object Context]:1:1
at Interface.<anonymous> (repl:96:19)
的prototype.js是1.7版本,Node.js的是版本0.2.6
你到底想用它對於? – 2011-02-10 05:25:34