Skip to content

Update notifier not working with public npm package #201

@vinaysharma14

Description

@vinaysharma14

System Information

  • OS: macOS Catalina 10.15.7 (19H15)
  • Package Version: ^5.0.1
  • Command Output:
    3.1.1
    /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/vinaysharma/Library/Android/sdk/emulator:/Users/vinaysharma/Library/Android/sdk/tools:/Users/vinaysharma/Library/Android/sdk/tools/bin:/Users/vinaysharma/Library/Android/sdk/platform-tools:/Users/vinaysharma/Development/flutter/bin:/Users/vinaysharma/Library/Android/sdk/emulator:/Users/vinaysharma/Library/Android/sdk/tools:/Users/vinaysharma/Library/Android/sdk/tools/bin:/Users/vinaysharma/Library/Android/sdk/platform-tools:/Users/vinaysharma/Development/flutter/bin
    darwin {
    node: '14.15.3',
    v8: '8.4.371.19-node.17',
    uv: '1.40.0',
    zlib: '1.2.11',
    brotli: '1.0.9',
    ares: '1.16.1',
    modules: '83',
    nghttp2: '1.41.0',
    napi: '7',
    llhttp: '2.1.3',
    openssl: '1.1.1g',
    cldr: '37.0',
    icu: '67.1',
    tz: '2020a',
    unicode: '13.0'
    }

Issue:

I need to show updates for a public npm package, Rapid React. Unfortunately update-notifier doesn’t seem to work. I debugged the notify() function by adding logs and found out the following.

Debugging:

console.log(!process.stdout.isTTY, suppressForNpm, !this.update); // false true true

// the if statement turns out to be true and code execution returns from here
if (!process.stdout.isTTY || suppressForNpm || !this.update || !semver().gt(this.update.latest, this.update.current)) {
    return this;
}

Code:

const updateNotifier = require('update-notifier');
const pkg = require('../package.json');
 
updateNotifier({ pkg }).notify();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions