codyc4321 codyc4321 - 2 months ago 14
Node.js Question

linked npm library not updating locally

I have the following library

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:');

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:


but right now I get a
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? Thank you

Answer Source

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.