Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Told me to update, but my version is already the latest one #67

Closed
gsklee opened this issue Dec 20, 2015 · 12 comments
Closed

Told me to update, but my version is already the latest one #67

gsklee opened this issue Dec 20, 2015 · 12 comments
Labels
bug 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted

Comments

@gsklee
Copy link

gsklee commented Dec 20, 2015

Issuehunt badges

More at: raineorshine/npm-check-updates/issues/190


IssueHunt Summary

fregante fregante has been rewarded.

Backers (Total: $60.00)

Submitted pull Requests


Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

@jokeyrhyme
Copy link
Contributor

jokeyrhyme commented May 9, 2016

A coworker experienced this today. I think using a consuming project multiple times and publishing an update to it in certain sequences (at a particular time of day) can cause this.

@sindresorhus
Copy link
Member

I haven't been able to reproduce this, but if anyone submits a failing test, I would be happy to look into it.

@jiripospisil
Copy link

Just bumped into this as well. I will look into it some more over the weekend, it's not the first time that's happened to me with various packages.

image

@kevva
Copy link
Member

kevva commented May 22, 2017

@jiripospisil, did you install npm@5.0.0-beta.49 with another Node version? If you have two global installs update-notifier doesn't know which one is the current.

@simonua
Copy link

simonua commented Jun 5, 2017

This happens to me somewhat frequently. Could it be a timing issue with synchronicity? As in, updating to latest version while a version check is occurring based on the original version in package.json just prior to the update? Maybe there's some sense in suspending the notifier when an install/update is occurring?

We've implemented this in our code, so this has definitely not just been in relation to npm but any update that occurs for one of our packages.

@zkat
Copy link

zkat commented Jun 5, 2017

@sindresorhus I'm getting a number of reports about this both on the npm issue tracker, and on twitter.

@krokofant
Copy link

krokofant commented Jun 28, 2017

Reproduce:

all output

 ~  npm install -g npm-check-updates@2.11.1
/usr/local/bin/npm-check-updates -> /usr/local/lib/node_modules/npm-check-updates/bin/npm-check-updates
/usr/local/bin/ncu -> /usr/local/lib/node_modules/npm-check-updates/bin/ncu
+ npm-check-updates@2.11.1
added 2 packages, removed 30 packages and updated 7 packages in 15.162s
 ~  nano ~/.config/configstore/update-notifier-npm-check-updates.json # lower the lastUpdateCheck and save
 ~  ncu -g
⸨░░░░░░░░░░░░░░░░░░⸩ ⠴ :
 aurelia-cli        0.30.0  →  0.30.1
 npm-check-updates  2.11.1  →  2.12.1

 ~  npm install -g npm-check-updates
/usr/local/bin/npm-check-updates -> /usr/local/lib/node_modules/npm-check-updates/bin/npm-check-updates
/usr/local/bin/ncu -> /usr/local/lib/node_modules/npm-check-updates/bin/ncu
+ npm-check-updates@2.12.1
added 30 packages, removed 2 packages and updated 7 packages in 8.044s
 ~  ncu -g


   ╭──────────────────────────────────────────────╮
   │                                              │
   │      Update available 2.11.1 → 2.12.1        │
   │   Run npm i -g npm-check-updates to update   │
   │                                              │
   ╰──────────────────────────────────────────────╯

⸨░░░░░░░░░░░░░░░░░░⸩ ⠴ :

short version

# install old npm-check-updates
npm install -g npm-check-updates@2.11.1
# reset the lastUpdate time
sed -i '' -E "s/([0-9]+)/0/" ~/.config/configstore/update-notifier-npm-check-updates.json
# make ncu check for updates once
ncu -g
# install latest
npm install -g npm-check-updates
# what's this now?
ncu -g

Remember to edit the configfile and lower the lastUpdateCheck and save.

@lucasbento
Copy link

I had the same issue here, a workaround that solved it is using the callback property and checking the version that's hold on update:

updateNotifier({
  pkg,
  callback: (data, update) => {
    if (!update || pkg.version === update.latest) {
      return;
    }

   console.log(chalk.cyan(
      `There's an update of ${pkg.name} available:`,
      chalk.dim(pkg.version), chalk.reset('→'), chalk.blue(update.latest),
      chalk.dim('\nRun'), chalk.green(chalk.bold(`npm i -g ${pkg.name}`)), chalk.dim('to update.'),
    ));
  },
});

@purplecabbage
Copy link

I resolved this using:

       if(notifier.update &&
           notifier.update.latest !== pkg.version) {
            // Notify using the built-in convenience method
            notifier.notify();
        }

eliangcs added a commit to zapier/zapier-platform-cli that referenced this issue Mar 28, 2018
A workaround for yeoman/update-notifier#67. To
reproduce the issue, follow these steps:

1. Create an app with an old version of zapier-platform-core in package.json.

2. Run `zapier build` once.

3. Update zapier-platform-core version in package.json to the latest version.

4. Run `zapier build` again. The expected behavior is that the notification
   shouldn't show, but it did.
@raineorshine
Copy link

const updateNotifier = require('update-notifier')
const pkg = require('../package.json')
const notifier = updateNotifier({ pkg })
if (notifier.update && notifier.update.latest !== pkg.version) {
    notifier.notify()
}

raineorshine added a commit to raineorshine/npm-check-updates that referenced this issue Mar 13, 2019
@IssueHuntBot
Copy link

@IssueHunt has funded $60.00 to this issue.


@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 10, 2019
@gsklee gsklee closed this as completed Nov 3, 2019
@issuehunt-oss
Copy link

issuehunt-oss bot commented Jan 23, 2020

@sindresorhus has rewarded $54.00 to @fregante. See it on IssueHunt

  • 💰 Total deposit: $60.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $6.00

@issuehunt-oss issuehunt-oss bot added 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt and removed 💵 Funded on Issuehunt This issue has been funded on Issuehunt labels Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.