Cannot find method 'attach' for sharejs object

785 views Asked by At

While following the tutorial link https://github.com/share/ShareJS/wiki/Tutorial%3A-The-Basics when i do the final

$node index.js

I get the following error.

/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$ 

Can anyone help please

1

There are 1 answers

0
C Blanchard On

The attach method has been deprecated in the latest version (0.7) and the documentation has not yet been updated to reflect this.

I think you've got two options to fix this. The simplest is to revert to version 0.6 using npm. Go to your working directory and:

  1. Uninstall your current version: npm uninstall share
  2. Install the previous version which corresponds to existing documentation: npm install [email protected]

The alternative is to dip into the source code on github and figure out how the author intends you to create a server instance in 0.7 onwards