【发布时间】:2013-12-01 13:55:34
【问题描述】:
按照教程链接https://github.com/share/ShareJS/wiki/Tutorial%3A-The-Basics 当我做决赛时
$node index.js
我收到以下错误。
/home/devilz/Project/lib/index.js:20
ShareJS.attach(server, ShareJSOpts);
^
TypeError: Object #<Object> has no method 'attach'
at Object.<anonymous> (/home/devilz/Project/lib/index.js:20:9)
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:901:3
devilz@devilz-pc:~/Project/lib$
谁能帮忙
【问题讨论】:
-
能否发布 index.js 的相关部分
-
var ShareJS,ShareJSOpts,连接,端口,服务器;连接 = 要求('连接'); ShareJS = require('share').server; ShareJSOpts = { browserChannel: { cors: "*" }, db: { type: "none" } };服务器 = connect.createServer(); server.use(connect['static'](__dirname + "/../static")); ShareJS.attach(服务器,ShareJSOpts);端口 = 5000; server.listen(port, function() { return console.log("监听" + port); });
标签: javascript node.js collaborative