Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

[BUG] when using express in electron : ReferenceError: self is not defined #195

Open
nadavten opened this issue Feb 16, 2017 · 10 comments
Open

Comments

@nadavten
Copy link

No description provided.

@freshp86
Copy link
Contributor

Probably because of this line https://github.com/google/lovefield/blob/master/dist/lovefield.js#L1.

@nadavten
Copy link
Author

nadavten commented Feb 16, 2017 via email

@freshp86
Copy link
Contributor

freshp86 commented Feb 16, 2017

Does it work if you wrap it with a try catch?

try {
  if(!self.window){window=self;}
} catch(e) { // do nothing }

I don't have an dummy electron project to try this (nor have I ever used it). Perhaps we could add a dummy electron demo under demos/ so that it is easier to catch those errors.

@nadavten
Copy link
Author

nadavten commented Feb 16, 2017 via email

@freshp86
Copy link
Contributor

Are you trying to run Lovefield in Node (assuming by express you mean http://expressjs.com/) ? If that is the case, we have this script https://github.com/google/lovefield/blob/master/tools/node_bootstrap.js, that does it (but it is currently not part of dist/). See usage examples at the top of that file.

@nadavten
Copy link
Author

not working for me. whats the part with 'dist' ?

@freshp86
Copy link
Contributor

freshp86 commented Feb 22, 2017

Currently if you

npm install lovefield

You will not find node_bootstrap.js anywhere in the node_modules/lovefield/ folder. You would need to get that file separately yourself, until we fix this (#190). Can you explain what did you try exactly that is not working? It should be something along the lines of https://github.com/google/lovefield/blob/master/tools/node_bootstrap.js#L20-L24.

@nadavten
Copy link
Author

nadavten commented Feb 22, 2017 via email

@freshp86
Copy link
Contributor

Can you explain what did you try exactly that is not working?

A screenshot of the error would be helpful.

  1. Is node_bootstrap.js executing?
  2. What line is exactly failing?
  3. Which method are you calling? Did you try loadCustomJs() and provide the correct path yourself?

@nadavten
Copy link
Author

nadavten commented Feb 23, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants