最佳答案
注意: 我已经尝试了其他解决方案给予 here,但它不工作
一个有 NodeJ 的新手。我试图遵循 AngularJS 专业和卡住了设置 NodeJs 服务器。根据书中介绍,我安装了 nodejs,然后使用 安装连接
then downloaded angularjs in folder next to nodejs folder. Then wrote server.js file to connect to server. Here is the content of the file:
var connect = require('connect');
connect.createServer(connect.static("../angularjs")).listen( 5000);
当我使用以下命令运行这个 server.js 文件时:
node server.js
我得到以下错误:
function app(req, res, next){ app.handle(req, res, next); }
merge(app, proto);
merge(app, EventEmitter.prototype);
app.route = '/';
app.stack = [];
return app;
has no method 'static'
at Object.<anonymous> (C:\web\nodejs\server.js:2:36)
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:906:3
Any ideas guys? 谢谢。