iVis-at-Bilkent / cytoscape.js-fcose

fCoSE: a fast Compound Spring Embedder
MIT License
140 stars 25 forks source link

"self is not defined" exception in nodejs #52

Closed jamesscottbrown closed 2 years ago

jamesscottbrown commented 2 years ago

I have installed the latest version of the package (2.1.0).

When I try to import it at the node REPL I encounter an error:

~/code/network/ $ node
Welcome to Node.js v16.13.0.
Type ".help" for more information.
> const cytoscape = require('cytoscape')
undefined
> const fcose = require('cytoscape-fcose')
Uncaught ReferenceError: self is not defined
    at Object.<anonymous> (/home/jsb/code/network/node_modules/cytoscape-fcose/cytoscape-fcose.js:10:4)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
> 

I also encounter the same ReferenceError: self is not defined with a more complex setup in which one file uses import to load the module, and performs the layout in a function that is imported by a second file that defines a test run by Jest.

This is possibly related to a similar issue in another cytoscape.js layout extension.

hasanbalci commented 2 years ago

This issue is fixed in the unstable branch with this commit. It will be available with the next release, you can use the extension from unstable branch until then.

tonxxd commented 2 years ago

For anyone who is facing the issue yarn add "https://github.com/iVis-at-Bilkent/cytoscape.js-fcose#unstable"

khaled commented 1 year ago

@hasanbalci Any chance this will get released some time soon? :)