Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • 1
    Hi... Just to confirm npm link in my-app/node_modules/react and then npm link react in the ui-library repository on my computer? Then build and run my-app again? Commented Dec 11, 2020 at 23:10
  • Okay, so as above I did the npm link and it has fixed the error for now. I am going to try publishing to GitLab and see if the lib still works or if I can reproduce this problem somehow. I presume that I will need to keep repeating this step? Commented Dec 11, 2020 at 23:27
  • This has happened to me several times and I have never tried this option, good to know. Commented Dec 12, 2020 at 0:07
  • It is a narrow fix. Going to be frustrating remembering to do this each time I npm install though. Going to see what happens when I publish it to my registry and install the package as a dependency, wonder if this step is exclusively for importing locally Commented Dec 12, 2020 at 0:20
  • Yes, I mentioned in my answer that the error can be caused by the local development. I don't think that you will face this issue when you publish the library. This step, in theory, should be avoided anyway because your ui-library components should be developed in isolation and not dependent on your main project. You can use a tool like Storybook to help you with this and it's also a great way to document the use cases of your ui-lib components. Commented Dec 12, 2020 at 9:31

lang-js