question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Basic Example can't be Reproduced

See original GitHub issue

Currently trying to run the basic example on react-cytoscapejs version 1.0.0 using create-react-app. Here’s what i have done:

npx create-react-app cytoscape-basic-app
cd cytoscape-basic-app
yarn add react-cytoscapejs@1.0.0

At this point, we change the src/App.js file with the following code modified from the basic example:

import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import CytoscapeComponent from 'react-cytoscapejs';

class App extends Component {
  constructor(props){
    super(props);
  }

  render(){
    const elements = [
       { data: { id: 'one', label: 'Node 1' }, position: { x: 0, y: 0 } },
       { data: { id: 'two', label: 'Node 2' }, position: { x: 100, y: 0 } },
       { data: { source: 'one', target: 'two', label: 'Edge from Node1 to Node2' } }
    ];

    return <CytoscapeComponent elements={elements} style="width: 600px; height: 600px;" />;
  }
}

export default App;

Running yarn start returns the following error:

./src/App.js
Module not found: Can't resolve 'react-cytoscapejs' in 'C:\Users\xingh\temp\test_cytoscape\cytoscape-app\src'

I solved this by changing the import statement to be:

import CytoscapeComponent from 'react-cytoscapejs/src';

Then the error became:

The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.
    in div (created by CytoscapeComponent)
    in CytoscapeComponent (at App.js:17)
    in App (at src/index.js:7)

which was solved by changing the return statement for the render() method to:

return <CytoscapeComponent elements={elements} style={{width: "600px", height: "600px"}} />;

Which compiled successfully.

I suggest updating the readme to take those problems into account. Let me know if I should start a PR. Thank you!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
maxkfranzcommented, Nov 4, 2018

I published v1.0.1. You should be able to import CytoscapeComponent from 'react-cytoscapejs', and the readme has been updated re. the style attribute in the example.

0reactions
JSymons7commented, Jul 27, 2021

Hi @maxkfranz, still seeing this issue when I try and run the basic example. Implementing above solution fixed it. Could well be user error. Shout out if you want any of my settings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Reproduce” is misleading; Use “Stopped Investigating ...
The problem with “Cannot Reproduce” is that there is a problem in the software, and the reason for the problem has not been...
Read more >
How to Reproduce a Non-Reproducible Defect and Make ...
If the bug is not reproducible, then the testing effort used in finding, analyzing and reporting that particular bug/defect is a total waste....
Read more >
Basic research crisis? Many results cannot be replicated
Many scientific studies cannot be replicated and this is symptomatic of a wider crisis in basic research, say scientists.
Read more >
How to create a Minimal, Reproducible Example - Help Center
Complete – Provide all parts someone else needs to reproduce your problem in ... Use simple, descriptive names for functions and variables –...
Read more >
Fixing Bugs - If You Can't Reproduce a Bug, You Can't Fix It
Fixing a problem usually starts with reproducing it – what Steve McConnell calls “stabilizing the error.” Technically speaking, you can't be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found