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

Ignore npm cache lines when calling 'npm view' for latest version #244

Merged
merged 1 commit into from
Aug 31, 2016

Conversation

domcleal
Copy link
Contributor

When the npm cache has expired or is empty, npm (version 1.3.6 at least)
outputs requests it's making to stderr which are interpreted as a
version number from the npm view command.

If using ensure=latest, this causes the package to be reinstalled every
time the cache expires:

Debug: Executing: '/bin/npm view phantomjs version'
Debug: /Package[phantomjs]/ensure: phantomjs "2.1.7" is installed, latest is "npm http GET https://registry.npmjs.org/phantomjs\nnpm http 200 https://registry.npmjs.org/phantomjs\n2.1.7"
Debug: Executing: '/bin/npm install --global phantomjs'
Debug: /Package[phantomjs]/ensure: phantomjs "2.1.7" is installed, latest is "npm http GET https://registry.npmjs.org/phantomjs\nnpm http 200 https://registry.npmjs.org/phantomjs\n2.1.7"
Notice: /Package[phantomjs]/ensure: ensure changed '2.1.7' to 'npm http GET https://registry.npmjs.org/phantomjs
npm http 200 https://registry.npmjs.org/phantomjs
2.1.7'

The npm logging lines are now filtered out similarly to the npm list
command.

When the npm cache has expired or is empty, npm (version 1.3.6 at least)
outputs requests it's making to stderr which are interpreted as a
version number from the `npm view` command.

If using ensure=latest, this causes the package to be reinstalled every
time the cache expires:

    Debug: Executing: '/bin/npm view phantomjs version'
    Debug: /Package[phantomjs]/ensure: phantomjs "2.1.7" is installed, latest is "npm http GET https://registry.npmjs.org/phantomjs\nnpm http 200 https://registry.npmjs.org/phantomjs\n2.1.7"
    Debug: Executing: '/bin/npm install --global phantomjs'
    Debug: /Package[phantomjs]/ensure: phantomjs "2.1.7" is installed, latest is "npm http GET https://registry.npmjs.org/phantomjs\nnpm http 200 https://registry.npmjs.org/phantomjs\n2.1.7"
    Notice: /Package[phantomjs]/ensure: ensure changed '2.1.7' to 'npm http GET https://registry.npmjs.org/phantomjs
    npm http 200 https://registry.npmjs.org/phantomjs
    2.1.7'

The npm logging lines are now filtered out similarly to the `npm list`
command.
@domcleal domcleal force-pushed the latest-ignore-npm-cache branch from 3672c20 to 1b3f0c0 Compare August 30, 2016 09:13
@juniorsysadmin
Copy link
Member

👍
For non-global npm installs under npm.pp we use execs and I believe always re-install if ensure is set to latest. Not sure if we can do a similar thing there.

@jyaworski jyaworski merged commit 01470e2 into voxpupuli:master Aug 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants