codyc4321
codyc4321

Reputation: 9682

Linked npm library not updating locally

I have the following library https://github.com/codyc4321/react-data-components-updated

I installed it in my react project locally like npm i ~/react-data-components-updated

Now running my node server I don't get any changes no matter what I do. I am seeing old print statements which I deleted, and my new ones are not coming:

  console.log('data in dataSort() in dataReducer.js:');
  console.log(state.data);

doesn't show up.

I have constantly reinstalled like $ npm i ~/react-data-components-updated/ and it isn't helping. I was seeing weird errors affecting this location:

http://localhost:3001/__webpack_hmr

but right now I get a 200 for that address and it still isn't updating. How can I use this library locally and have my project update when it sees changes?

Upvotes: 3

Views: 3331

Answers (1)

GMaiolo
GMaiolo

Reputation: 4628

Problem is that your package got installed and is now in your-project-folder/node_modules, so in order for the modifications to replicate you have four options:

  • Directly modify the scripts in your-project-folder/node_modules/react-data-components-updated [not recommended]
  • Delete your-project-folder/node_modules/react-data-components-updated and run npm i ~/react-data-components-updated
  • Runnpm uninstall react-data-components-updated && npm i ~/react-data-components-updated so it reinstalls with the current files.
  • Go to ~/react-data-components-updated/package.json and upgrade the version manually (or by CLI) and then running npm update in your project.

Depending on your needs and how you're handling changes in your local package, one may be better than the other.

Upvotes: 3

Related Questions