create-react-library icon indicating copy to clipboard operation
create-react-library copied to clipboard

Module not found on example project after deleting node_modules folders

Open itofarina opened this issue 5 years ago • 4 comments

First of all thank you for creating this amazing project. I have been using it for a while and I am really happy with this 🙂

Bug description

Unable to run example app after deleting node_modules folders

Steps to reproduce

  1. Create a library "@test/name" with npx create-react-library and choose Typescript
  2. Once it's ready, delete node_modules folders for both projects
  3. Run npm install on "@test/name" folder. Then npm start.
  4. On another tab, run cd example && npm start

Expected result

To have the exmaple app running

Actual result

Failed to compile.

./src/App.tsx
Module not found: Can't resolve '@test/name' in '/Users/alvarofarina/Desktop/name/example/src'

Update

Using yarn solves the issue

itofarina avatar Jul 02 '20 20:07 itofarina

This is not issues need to install yarn inside the example folder

run cd example && yarn && yarn start

durgapatra avatar Jul 27 '20 04:07 durgapatra

Hey @durgapatra, so, 3 days ago you commented this:

I getting the same issues when clone project and yarn install not working.

Now you deleted your previous comment, downvote the issue and say something totally different. Well, I think it's an issue at least with npm and if someone ends up here it would be nice to read that they could solve the problem using yarn. What do you think?

itofarina avatar Jul 27 '20 15:07 itofarina

Hi @farinalvaro I don't know if you still have this issue, but if you do, could you share your package.json for both projects?

psyycker avatar Jul 27 '20 16:07 psyycker

Hi @psyycker Sorry for the delay, I created this repo to reproduce the error: https://github.com/farinalvaro/crl-test If I do npm i on example I get an error:

npm ERR! Maximum call stack size exceeded

Only after running yarn I'm able to generate the example/node_modules folder properly and so able to run the sandbox project.

It's happening at least with node versions 10, 12 and 14

Thank you!

itofarina avatar Oct 30 '20 18:10 itofarina