carteb / carte-blanche

An isolated development space with integrated fuzz testing for your components. See them individually, explore them in different states and quickly and confidently develop them.
https://www.youtube.com/watch?v=6g3-TQ6aaw8
MIT License
1.5k stars 47 forks source link

Generating metadata failed Error: getNodeFromInstance: Invalid argument. #389

Open MicheleBertoli opened 7 years ago

MicheleBertoli commented 7 years ago

hey! I tried to setup carte-blanche starting from an app created with create-react-app but I couldn't make it work. I always get Generating metadata failed Error: getNodeFromInstance: Invalid argument. when I click on a component in the sidebar.

steps to reproduce:

1) create app

npm i create-react-app -g // 0.2.0
create-react-app carte-blanche-test
cd carte-blanche-test
npm run eject
npm i carte-blanche --save-dev // 0.3.1

2) edit webpack config

var CarteBlanche = require('carte-blanche');
...
plugins: [
  ...,
  new CarteBlanche({
    componentRoot: './src'
  })
]

3) start app

npm start

4) select component open http://localhost:3000/carte-blanche click "App" in the sidebar

tweettypography commented 7 years ago

I'm encountering the same issue. Did you get it figured out?

S-Venkat-S commented 7 years ago

I am also having this same issue.

tandrewnichols commented 7 years ago

Some similar issues in other repos suggested: 1) Updating react and react-dom to 15.3.1 (didn't work for me), 2) downgrading react and react-dom to 15.1.0 (also didn't work for me). Also tried using node 5.5 as that's specified under "engines." This didn't work either. Giving up.

tandrewnichols commented 7 years ago

Alternatively, check out @kadira/storybook, which requires a bit more setup than this, but actually works.

S-Venkat-S commented 7 years ago

@mxstbr Any update on this issue ? 😢

fionawhim commented 7 years ago

My quick read on this issue is that React is being added to the page twice. Once by the client-bundle.js file that's precompiled and distributed with carte-blanche, and once by the user-bundle that’s built from your own code (and presumably requires React).

I wonder if it’s possible to build the client-bundle code dynamically, or alternately to try and prevent the user-bundle React from affecting anything globally outside of the iframe.

fionawhim commented 7 years ago

Alternately it may be that the bundled React is one of the 15.1.x versions that break on findDOMNode. I've rebuilt the project from master and can't reproduce the problem anymore.