# Nexus is unable to update the latest NPM dependency package in time

**URL:** https://community.sonatype.com/t/nexus-is-unable-to-update-the-latest-npm-dependency-package-in-time/6729
**Category:** Sonatype Nexus Repository
**Tags:** nexus-repository
**Created:** [June 15, 2021, 7:49am UTC](https://community.sonatype.com/t/nexus-is-unable-to-update-the-latest-npm-dependency-package-in-time/6729 "2021-06-15T07:49:07Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![smbands](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@smbands](https://community.sonatype.com/u/smbands)
#### Post date: [June 15, 2021, 7:49am UTC](https://community.sonatype.com/t/nexus-is-unable-to-update-the-latest-npm-dependency-package-in-time/6729/1 "2021-06-15T07:49:07Z")

</div>

Hello everyone  
My environment：  
Use nexus as the repository of npm, and nexus points to the official repository of npm.

My question:  
When I install some dependencies using NPM, Most npm dependent packages can be downloaded normally.  
However, some of them cannot be downloaded, and a 404 error is reported. At this time, I checked that the dependency package of this version did exist on the official website, and it was a new version that was updated a few hours ago, but this package was not synchronized in the nexus warehouse.

```
  My npm package.json and package-lock.json does not specify the version of the dependent package, the default is the latest version.
  It will look for the latest version of the dependency package by itself. At this time, the latest version of the dependency package exists in the official repository, but does not exist in the nexus repository.

  So I think it should be a problem with the update mechanism of nexus to the proxy , but I can’t find where to configure it. Please help me.
```

---

<div class="post-metadata">

### Author: ![dsawa](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/dsawa/32/729_2.png) [@dsawa](https://community.sonatype.com/u/dsawa)
#### Post date: [June 15, 2021, 8:20am UTC](https://community.sonatype.com/t/nexus-is-unable-to-update-the-latest-npm-dependency-package-in-time/6729/2 "2021-06-15T08:20:05Z")

</div>

Hi Smbands,  
That sounds about right. Behaviour you described is due to caching NXRM performs in order to save your network bandwidth. It will re-check for latest version after caching time expires or you invalidate the cache. You can tweak how often NXRM will chcek for updated content in your upstream provider on your repository settings page. On the same page you can find a button to immediately invalidate the cache.

---

<div class="post-metadata">

### Author: ![smbands](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@smbands](https://community.sonatype.com/u/smbands)
#### Post date: [June 16, 2021, 1:45am UTC](https://community.sonatype.com/t/nexus-is-unable-to-update-the-latest-npm-dependency-package-in-time/6729/3 "2021-06-16T01:45:50Z")

</div>

@dsawa  
Thanks a lot for your answer.  
I probably understand, and I know where to modify it according to your description.  
“Invalidate cache” button  
I think the next time this happens clicking on this button will invalidate the current cache and force it to reload the cache.Then I can get the latest version of the dependency package from the broker’s repository address.I’m looking forward to seeing this again so I can verify it.

 ![图片](https://canada1.discourse-cdn.com/flex047/uploads/communitysonatype/original/2X/a/aae3f6a3b388c1e93c67944ee5ee1aaa501e44b0.png)  
And I can configure the time in the image to control the frequency of cache updates, do I understand that right?

Looking forward to your reply  
Thank you again！！！

---

<div class="post-metadata">

### Author: ![smbands](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@smbands](https://community.sonatype.com/u/smbands)
#### Post date: [June 16, 2021, 6:02am UTC](https://community.sonatype.com/t/nexus-is-unable-to-update-the-latest-npm-dependency-package-in-time/6729/4 "2021-06-16T06:02:39Z")

</div>

I found related configuration methods,see：

> **[How should I configure Proxy Repository Cache setting](https://support.sonatype.com/hc/en-us/articles/115010182627-How-should-I-configure-Proxy-Repository-Cache-setting)**
>
> .
> Proxy repositories use caching to improve build performance. The settings you can use to configure caching are described in this article.
> Cache Settings
> Caching is configured in the settings of e...

Thank you all the same  
Best wishes!!!

---

<div class="post-metadata">

### Author: ![dsawa](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/dsawa/32/729_2.png) [@dsawa](https://community.sonatype.com/u/dsawa)
#### Post date: [June 16, 2021, 8:33am UTC](https://community.sonatype.com/t/nexus-is-unable-to-update-the-latest-npm-dependency-package-in-time/6729/5 "2021-06-16T08:33:16Z")

</div>

Yes, you are correct.
