Skip to content

prefer-offline = true interferes with global installs #1346

@Alhadis

Description

@Alhadis

Description

Having prefer-offline = true in one's .npmrc file affects NPM's ability to update globally-installed modules:

λ Desktop: npm --global install jsvu@latest
/usr/local/bin/jsvu -> /usr/local/lib/node_modules/jsvu/cli.js
+ [email protected]
updated 2 packages in 4.448s
λ Desktop: sed -i.bak -e '/^prefer-offline =/ s/true/false/' ~/.npmrc
λ Desktop: npm --global install jsvu@latest
/usr/local/bin/jsvu -> /usr/local/lib/node_modules/jsvu/cli.js
+ [email protected]
added 4 packages from 3 contributors, removed 4 packages and updated 23 packages in 19.093s

In fact, having prefer-offline appears to inhibit a lot of functionality related to global installations, like showing outdated information for npm show $module_name (when http://npmjs.com/package/* clearly shows there's a newer version available).

Here's my .npmrc config in its entirety:

cache          = ~/.cache/npm
engine-strict  = true
if-present     = true
logs-max       = 1
message        = "Release v%s"

; Prefer existing installs
optional       = false
prefer-offline = true

; Tell NPM to pull its head in
package-lock   = false
save           = false

; Improve CLI output
depth          = 0
fund           = false
heading        = ""
long           = true
unicode        = true
usage          = true

; Authentication tokens, defined in environment
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions