Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

library wont update on change #67

Closed
obiwankenoobi opened this issue Sep 23, 2018 · 8 comments
Closed

library wont update on change #67

obiwankenoobi opened this issue Sep 23, 2018 · 8 comments

Comments

@obiwankenoobi
Copy link

obiwankenoobi commented Sep 23, 2018

Hey! (: First of all thank you so much for your tool - It has been a real need for me!

I have a little problem though - I tried to test it by simply changing src/index.js and I can't really see it changed on my dev server. I deleted completely the content of the component but all I get in my development server its still Example Component: title.

to start the project I simply did npm start from root and later npm start from example/ , later I tried to npm run build to see if I can get any changes after build but no luck there either.

If I make changes in example/ I can see them and it's all works great. Only the library one doesn't.

This is the console output from the library server:

rollup v0.64.1
bundles src/index.js → dist/index.js, dist/index.es.js...
created dist/index.js, dist/index.es.js in 53ms

[2018-09-23 15:17:24] waiting for changes...

Am I missing something?

Thank you!

@transitive-bullshit
Copy link
Owner

Do you have two tabs open, one running npm start from the root, and one running npm start from example/?

I'd start with just npm start at the root, make a change to src/index.js, and you should immediately see rollup recompile your library. If not, then something's going wrong and I'm happy to help you diagnose the issue.

@obiwankenoobi
Copy link
Author

obiwankenoobi commented Sep 24, 2018

yep this was exactly what I've been doing. When I save I can see in the terminal this part flashing and the date is updating but the changes do not reflect.

bundles src/index.js → dist/index.js, dist/index.es.js...
created dist/index.js, dist/index.es.js in 97ms

[2018-09-24 13:34:22] waiting for changes...

Please check the repo I created with the library installed and note src/index.js which I clearly removed its content but yet it show on the project
https://github.com/obiwankenoobi/create-react-library-bug

@transitive-bullshit
Copy link
Owner

Ahh, most likely what's going on is that you're using npm for installing and running commands but you had chosen yarn during the creation process.

CRL is using file:.. or link:.. depending on which package manager you're using, and unfortunately yarn and npm handle local linking completely differently. We're doing this so we don't have to rely on npm link since the relationship between the example and the source library is constant.

In short, if you wipe node_modules in both the src and example and use the package manager you selected during library creation, the changes should propagate correctly.

I think this would be a pretty easy area to add some debugging output if we detect you're running a different package manager than the one the library was bootstrapped with.

@obiwankenoobi
Copy link
Author

obiwankenoobi commented Sep 24, 2018

So I tried your solution and removed node_modules in both directories but it didn't worked, then I tried to create new project and I still had this issue.
At the end I tried to create new project with yarn as package manager and I got this error:

✖ Running yarn install and yarn link
{ Error: Command failed: /bin/sh -c yarn install
warning react-scripts > babel-preset-react-app > babel-preset-env > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > css-loader > cssnano > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > css-loader > cssnano > postcss-merge-rules > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > css-loader > cssnano > postcss-merge-rules > caniuse-api > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
error [email protected]: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0".
error An unexpected error occurred: "Found incompatible module".

yarn install v1.5.1
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info If you think this is a bug, please open a bug report with the information provided in "/Users/react-lib/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

    at makeError (/usr/local/lib/node_modules/create-react-library/node_modules/execa/index.js:172:9)
    at Promise.all.then.arr (/usr/local/lib/node_modules/create-react-library/node_modules/execa/index.js:277:16)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  code: 1,
  stdout: 'yarn install v1.5.1\ninfo No lockfile found.\n[1/5] Validating package.json...\n[2/5] Resolving packages...\n[3/5] Fetching packages...\ninfo If you think this is a bug, please open a bug report with the information provided in "/Users/artiumsirchenko/Desktop/coding/learning/school_projects/react/react-input-with-validation/yarn-error.log".\ninfo Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.\n',
  stderr: 'warning react-scripts > babel-preset-react-app > babel-preset-env > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.\nwarning react-scripts > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.\nwarning react-scripts > css-loader > cssnano > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.\nwarning react-scripts > css-loader > cssnano > postcss-merge-rules > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.\nwarning react-scripts > css-loader > cssnano > postcss-merge-rules > caniuse-api > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.\nerror [email protected]: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0".\nerror An unexpected error occurred: "Found incompatible module".\n',
  failed: true,
  signal: null,
  cmd: '/bin/sh -c yarn install',
  timedOut: false,
  killed: false }

@transitive-bullshit
Copy link
Owner

The engine "node" is incompatible with this module.

What this error is saying is that your version of node is incompatible with the latest version of eslint that yarn had resolved.

This is an unfortunate side effect of eslint's fractured Node.js support (it requires very specific sub-major versions of Node.js), and I'm really sorry that your experience with this CLI has been so poor.

I'm not sure the best way of solving this issue in general, but I would love to get things to a place where:

  1. the CLI is much more robust and this almost never happens to people
  2. if it does happen, the error messages are less cryptic than the one you received

@obiwankenoobi
Copy link
Author

no worries man! Great tool anyway, unfortunately I will have to ind other solutions! (:

@ShahriarSayeed
Copy link

Same problem. Can't resolve it. So leaving it.

@transitive-bullshit transitive-bullshit mentioned this issue Mar 5, 2019
4 tasks
@transitive-bullshit
Copy link
Owner

This should be fixed now with the latest v3 release.

Please open a new issue if you're still seeing this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants