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 fails with an error, does not say _where_ the issue lies. #1703

Closed
andreieftimie opened this issue Aug 22, 2020 · 15 comments
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@andreieftimie
Copy link

Current Behavior:

$ npm outdated --all
npm ERR! Only tag, version, and range are supported

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/aeftimie/.npm/_logs/2020-08-22T16_25_38_984Z-debug.log

The complete log:

$ cat /Users/aeftimie/.npm/_logs/2020-08-22T16_25_38_984Z-debug.log
0 verbose cli [
0 verbose cli   '/Users/aeftimie/.nvm/versions/node/v12.16.1/bin/node',
0 verbose cli   '/Users/aeftimie/.nvm/versions/node/v12.16.1/bin/npm',
0 verbose cli   'outdated',
0 verbose cli   '--all'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:/Users/aeftimie/.nvm/versions/node/v12.16.1/lib/node_modules/npm/npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:/Users/aeftimie/work/vo/vod/.npmrc Completed in 0ms
9 timing config:load:project Completed in 0ms
10 timing config:load:file:/Users/aeftimie/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/Users/aeftimie/.nvm/versions/node/v12.16.1/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 6ms
18 verbose npm-session e773fd4ecdc5fcb6
19 timing npm:load Completed in 11ms
20 timing arborist:ctor Completed in 0ms
21 timing command:outdated Completed in 10471ms
22 verbose stack Error: Only tag, version, and range are supported
22 verbose stack     at pickManifest (/Users/aeftimie/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:92:11)
22 verbose stack     at module.exports (/Users/aeftimie/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:186:18)
22 verbose stack     at getOutdatedInfo (/Users/aeftimie/.nvm/versions/node/v12.16.1/lib/node_modules/npm/lib/outdated.js:147:22)
22 verbose stack     at runMicrotasks (<anonymous>)
22 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
22 verbose stack     at async Promise.all (index 1248)
22 verbose stack     at async outdated_ (/Users/aeftimie/.nvm/versions/node/v12.16.1/lib/node_modules/npm/lib/outdated.js:201:3)
22 verbose stack     at async outdated (/Users/aeftimie/.nvm/versions/node/v12.16.1/lib/node_modules/npm/lib/outdated.js:43:16)
23 verbose cwd /Users/aeftimie/work/vo/vod
24 verbose Darwin 19.6.0
25 verbose argv "/Users/aeftimie/.nvm/versions/node/v12.16.1/bin/node" "/Users/aeftimie/.nvm/versions/node/v12.16.1/bin/npm" "outdated" "--all"
26 verbose node v12.16.1
27 verbose npm  v7.0.0-beta.6
28 error Only tag, version, and range are supported
29 verbose exit [ 1, undefined ]

Expected Behavior:

  1. It should not fail. If there are non-conform package versions in the tree those should be noted and an output should still be presented. This should not be an all-or-nothing operation

  2. If it fails, it should point the user in the direction of the failure, so that he may address the issue.

In my case I do have a fairly complex dependency tree. Yet I have to go one by one through all deps, from all packages to figure out where this error comes from.

Steps To Reproduce:

No specific steps at this time. I might try to get a minimal reproducible testcase.

Environment:

  • macOS Catalina 10.15.6
  • node: v12.16.1
  • npm: v7.0.0-beta.6
  • workspaces enabled
@andreieftimie andreieftimie 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 Aug 22, 2020
@ruyadorno
Copy link
Contributor

Hi @andreieftimie let me know in case there's a public repo in which we can easily reproduce the problem 😊

@ruyadorno ruyadorno added beta and removed Needs Triage needs review for next steps labels Sep 23, 2020
ruyadorno added a commit to ruyadorno/cli that referenced this issue Sep 24, 2020
This commit fixes a problem in which npm outdated was breaking when
trying to read an invalid semver range spec defined for a given
installed dep by performing the `npm-package-arg` parsing within a
try/catch block instead of expecting to read properties from the
returned instance.

Also, adds the missing test for that specific line of code.

Fixes npm#1703
ruyadorno added a commit to ruyadorno/cli that referenced this issue Sep 29, 2020
This commit fixes a problem in which npm outdated was breaking when
trying to read an invalid semver range spec defined for a given
installed dep by performing the `npm-package-arg` parsing within a
try/catch block instead of expecting to read properties from the
returned instance.

Also, adds the missing test for that specific line of code.

Fixes npm#1703
nlf pushed a commit that referenced this issue Sep 29, 2020
This commit fixes a problem in which npm outdated was breaking when
trying to read an invalid semver range spec defined for a given
installed dep by performing the `npm-package-arg` parsing within a
try/catch block instead of expecting to read properties from the
returned instance.

Also, adds the missing test for that specific line of code.

Fixes #1703

PR-URL: #1857
Credit: @ruyadorno
Close: #1857
Reviewed-by: @nlf
nlf pushed a commit that referenced this issue Sep 29, 2020
This commit fixes a problem in which npm outdated was breaking when
trying to read an invalid semver range spec defined for a given
installed dep by performing the `npm-package-arg` parsing within a
try/catch block instead of expecting to read properties from the
returned instance.

Also, adds the missing test for that specific line of code.

Fixes #1703

PR-URL: #1857
Credit: @ruyadorno
Close: #1857
Reviewed-by: @nlf
@ruyadorno
Copy link
Contributor

hi @andreieftimie thanks for the report! 😄 This should be fixed in v7.0.0-beta.13

Let us know in case there are still problems 😊 Thanks again!

@andreieftimie
Copy link
Author

@ruyadorno thanks. I can confirm npm outdated now works on the use-case mentioned above.

@lilisgeorge
Copy link

lilisgeorge commented Dec 5, 2020

On WSL2 - Ubuntu 20.04 using nvm and having installed v15.2.1 and today v15.3.0 i receive the same bug for both of those versions. Switched back to v14.15.1 and the problem is gone. npm version was 7.0.14. Now is 6.14.8

@jamessouth
Copy link

I'm getting this error today on Windows 10, npm 7.0.15, node 14.15.1

@ljharb
Copy link
Contributor

ljharb commented Dec 20, 2020

@jamessouth try npm v7.3.0?

@jamessouth
Copy link

...but not anymore, npm outdated is working as expected for me today...??? same versions 😕

@pathros
Copy link

pathros commented Jan 10, 2021

npm outdated
is no longer working. The versions I'm using are:
npm v7.0.15
node v15.4.0

The error displayed is:

npm ERR! Only tag, version, and range are supported
npm ERR! A complete log of this run can be found in:

@ljharb
Copy link
Contributor

ljharb commented Jan 10, 2021

Try v7.4.0?

@erichoswald
Copy link

For me the dependency that causes the error is

"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.2",

which I need to use tailwindcss with PostCSS 7, see https://tailwindcss.com/docs/installation#post-css-7-compatibility-build

So the workaround for me is to delete that line, run npm outdated, and restore it again. I'm using npm v7.5.2 BTW.

@AlexanderYW
Copy link

Same issue as @erichoswald, thanks for the tip! :)

@pastelmind
Copy link

Same issue with NPM v7.6.0. npm outdated fails due to an outdated package that is installed under an alias:

// package.json
{
  // ...
  "devDependencies": {
    // ...
    "package-alias": "npm:actual-package-name@^0.0.5",
    // ...
  }
}

I tried to replicate this by creating a sample project, but could not. Perhaps it happens if there are multiple dependencies and one of them is aliased AND outdated.

@ruyadorno
Copy link
Contributor

Thanks @erichoswald @pastelmind, that's a different problem, I opened #2800 to track and fix it.

@Isaac-Tait
Copy link

Isaac-Tait commented Apr 15, 2021

Thank you @erichoswald #2800 (comment)

@hirasso
Copy link

hirasso commented Aug 4, 2022

For me the dependency that causes the error is

"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.2",

which I need to use tailwindcss with PostCSS 7, see https://tailwindcss.com/docs/installation#post-css-7-compatibility-build

So the workaround for me is to delete that line, run npm outdated, and restore it again. I'm using npm v7.5.2 BTW.

@erichoswald Thanks for the hint! For me it was this line:

"gsap": "npm:@gsap/shockingly@^3.10.4",

Removed it, ran npm outdated, added it back.

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

No branches or pull requests