thingdom / node-neo4j

[RETIRED] Neo4j graph database driver (REST API client) for Node.js
Apache License 2.0
926 stars 138 forks source link

Neo4j on Parse: ReferenceError: window is not defined #124

Closed chrisby closed 10 years ago

chrisby commented 10 years ago

Hi I try install node-neo4j on Parse (https://www.parse.com) to connect to neo4j throgh their CloudCode. I have to adjust all paths for the required modules in most of the.js files. But now I get this error:

ReferenceError: window is not defined at neo4j/node_modules/streamline/lib/globals.js:23:50 at exports.undefined.Streamline.runtime (neo4j/node_modules/streamline/lib/callbacks/runtime.js:6:12) at neo4j/node_modules/streamline/lib/callbacks/runtime.js:257:3 at neo4j/lib/GraphDatabase.js:2:10 at neo4j/lib/index.js:26:27 at neo4j/lib/index.js:34:4 at main.js:2:14

What's wrong here?

aseemk commented 10 years ago

It sounds like Parse's server-side JS environment isn't actually Node.js.

I say that because you're saying you had to adjust paths, and the stack trace is suggesting that global doesn't exist (which it does on Node):

https://github.com/Sage/streamlinejs/blob/v0.10.12/lib/globals.js#L23

It might be possible to get node-neo4j to run in other server-side JS environments, but it'd probably be a pretty big stretch, as node-neo4j's dependencies (e.g. for making HTTP requests) are pretty tied to Node.js APIs.

I have no experience with Parse myself, but perhaps you could check with them?

chrisby commented 10 years ago

You're right, Parse's server side JS environment is not the "real" Node.js. I actually use neo4j's Rest API through httprequests now. Thanks though!

aseemk commented 10 years ago

No prob, cheers.