Do you want to request a feature or report a bug?
BUG/ERROR
What is the current behavior?
"Element ref was specified as a string" error when using npm link
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
https://github.com/odrzutowiec/react-bootstrap-jest-link-bug
What is the expected behavior?
Shouldn't error
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 16.4 OSX 10.13 (Chrome 66, but it doesnt matter)
Hello, I am really sorry for reporting this issue, but I got nowhere else to turn. Can you help me identify if there's a problem with my webpack in /lib or is this due to react-bootstrap/uncontrollable? Or just help me understand what is wrong here. I googled for two days, some people seem to have the same issue but no one received an answer or solution. I did npm ls react and it shows only one line, but im not sure if it takes into account the npm linked package.
I believe this issue is related or at least similar https://github.com/facebook/react/issues/12626
What is the full text of the error? I believe it should link to a page that explains this can happen when you have duplicate React in the bundle. I think your npm link workflow probably causes this problem because you pick up React both in your app and in your library node_modules. Try deleting it in the library node_modules, or link it back to your app鈥檚 copy.
@gaearon Dan you are a genius! I would have never think about removing node_modules/react and node_modules/react-dom inside my library! I removed them and the build process for my application still worked just fine (because library was already built anyway). That proved to me that the error message I was seeing "Element ref was specified as a string but no owner was set. (...) 3. You have multiple copies of React loaded" was true. Now I can experiment with my webpack builds and make sure that my library does not pull in another copy of react library.
Let me know if there is any way for I can make it up for your time spent on this issue.
I spent a few seconds :-) It鈥檚 a relatively common problem. Thanks for the offer though!
Most helpful comment
What is the full text of the error? I believe it should link to a page that explains this can happen when you have duplicate React in the bundle. I think your npm link workflow probably causes this problem because you pick up React both in your app and in your library node_modules. Try deleting it in the library node_modules, or link it back to your app鈥檚 copy.