Sometimes, when using React libraries, such as react-router, I get this error:
Uncaught TypeError: Cannot read property \'firstChild\' of undefined
In case anyone has this issue having npm link
ed two modules depending on react, I found a solution...
Let's say you have Parent depending on React, and Child depending on react. When you do:
cd ../child
npm link
cd ../parent
npm link child
This causes this problem, because parent and child will each load their own instance of React.
The way to fix this is as follows:
cd parent
cd node_modules/react
npm link
cd ../../../child
npm link react
This ensures your parent project supplies the react dependency, even when linked, which is how npm would resolve the dependency when you are unlinked.