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

[BUG] npm outdated no longer exits with code 1 if outdated #2556

Closed
gfyoung opened this issue Jan 27, 2021 · 8 comments
Closed

[BUG] npm outdated no longer exits with code 1 if outdated #2556

gfyoung opened this issue Jan 27, 2021 · 8 comments
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@gfyoung
Copy link
Contributor

gfyoung commented Jan 27, 2021

Current Behavior:

Exits with code 0.

Expected Behavior:

Exits with code 1.

Steps To Reproduce:

#!/usr/bin/env bash

FOLDER=`mktemp -d`

echo $FOLDER

cd $FOLDER

# https://www.npmjs.com/package/@npmcli/arborist
npm install @npmcli/arborist@2.0.5 --save

npm outdated

echo $?

This echos 0 and not 1.

Environment:

OS: MacOS Catalina
Node: v15.7.0
npm: 7.4.3

When I run the same script with:

OS: MacOS Catalina
Node: v13.0.1
npm: 6.14.0

I get the output of 1 at the end as expected.

@gfyoung gfyoung added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Jan 27, 2021
@wraithgar wraithgar added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Feb 2, 2021
@metasean
Copy link

metasean commented Mar 5, 2021

I'm running into the same bug with:
OS: MacOS Catalina
Node: v14.16.0
npm: 7.6.0

edited: I was in the wrong terminal when I initially ran my node -v and npm -v 😞 ; these values are from the same terminal as the non-responsive command.

@metasean
Copy link

metasean commented Mar 5, 2021

Based on a cursory search, it looks like this is the PR where the exitCode was removed - 3743a42#diff-fcab44373f1f924f030ce92d009f10ab53d45e7a55422870b55f3c7f8af1796d

@gfyoung
Copy link
Contributor Author

gfyoung commented Mar 5, 2021

@metasean: Nice catch!

@claudiahdz @ruyadorno: Was there a reason for the exit code change?

@db-developer
Copy link

db-developer commented Jul 28, 2021

Not sure, if this is the same feature.
See the difference in ERRORLEVEL 1 vs 0 (0 in actual versions)

nodejs version: v14.16.0
npm version: 6.14.11
src\test\tmp\project-04>npm outdated & echo %ERRORLEVEL%
Package Current Wanted Latest Location
grunt MISSING 1.4.1 1.4.1 example-project-00
1

nodejs version: v15.14.0
npm version: 7.7.6
src\test\tmp\project-04>npm outdated & echo %ERRORLEVEL%
Package Current Wanted Latest Location Depended by
grunt MISSING 1.4.1 1.4.1 - project-04
0

Besides "Location" should be "project-04" where as "Dependend by" should be "example-project-00" I guess. The later is the projects name within package.json in directory project-04.

@PatrickSpies
Copy link

Any updates on this?

@db-developer
Copy link

Did not check.
I switched to using this: https://www.npmjs.com/package/check-outdated.
For my grunt builds I wrote this: https://www.npmjs.com/package/grunt-check-outdated (which is based on the previous)
... I'm sure there are even more alternatives.

gfyoung added a commit to forking-repos/cli that referenced this issue Sep 26, 2021
closes: npm#2556
xref: npm#1750

The xref'ed PR apparently dropped this behavior
without any explanation.
gfyoung added a commit to forking-repos/cli that referenced this issue Sep 26, 2021
closes: npm#2556
xref: npm#1750

The xref'ed PR apparently dropped this behavior
without any explanation.
@gfyoung
Copy link
Contributor Author

gfyoung commented Sep 26, 2021

Finally got around to just doing it myself 🙂

#3799

wraithgar pushed a commit that referenced this issue Sep 27, 2021
closes: #2556
xref: #1750

The xref'ed PR apparently dropped this behavior
without any explanation.

PR-URL: #3799
Credit: @gfyoung
Close: #3799
Reviewed-by: @wraithgar
@gfyoung
Copy link
Contributor Author

gfyoung commented Sep 27, 2021

#3799 has been merged! Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants