`npm list` does not list modules at alpha versions

What I Wanted to Do

I ran npm list to confirm the version of React that I am using (16.8.0-alpha.0).

I expected it to be listed

What Happened Instead

React was not listed in my dependencies

Reproduction Steps

Run the following in an empty directory:

npm init
npm install react@16.8.0-alpha.0
npm install react-dom@16.8.0-alpha.0
npm list react

You will see:

npm-ls-bug@1.0.0 /Users/danrumney/WebstormProjects/npm-ls-bug
└── (empty)

Instead of a listing for react

Details

There’s no debug log because npm isn’t detecting an error here.

The full list is:

β”œβ”€β”¬ UNMET PEER DEPENDENCY react@16.8.0-alpha.0
β”‚ β”œβ”€β”¬ loose-envify@1.4.0
β”‚ β”‚ └── js-tokens@4.0.0
β”‚ β”œβ”€β”€ object-assign@4.1.1
β”‚ β”œβ”€β”¬ prop-types@15.6.2
β”‚ β”‚ β”œβ”€β”€ loose-envify@1.4.0 deduped
β”‚ β”‚ └── object-assign@4.1.1 deduped
β”‚ └─┬ scheduler@0.13.0-alpha.1
β”‚   β”œβ”€β”€ loose-envify@1.4.0 deduped
β”‚   └── object-assign@4.1.1 deduped
└─┬ react-dom@16.8.0-alpha.0
  β”œβ”€β”€ loose-envify@1.4.0 deduped
  β”œβ”€β”€ object-assign@4.1.1 deduped
  β”œβ”€β”€ prop-types@15.6.2 deduped
  └── scheduler@0.13.0-alpha.1 deduped

So, somewhere in the mix, react is being detected, but not when you look specifically. In addition, it looks like react can’t be detected while seeking peer dependencies.

Platform Info

$ npm --versions
{ 'ohana-pediatrics': '2.0.0',
  npm: '6.5.0',
  ares: '1.15.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.14.2',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.45',
  zlib: '1.2.11' }

$ node -p process.platform
darwin

Reproduced, although it seems to work fine with react@16.7.0. I get why it is reported as an unmet peer dependency:

  • ^1.2.3-beta.2 := >=1.2.3-beta.2 <2.0.0 Note that prereleases in the 1.2.3 version will be allowed, if they are greater than or equal to beta.2. So, 1.2.3-beta.4 would be allowed, but 1.2.4-beta.2 would not, because it is a prerelease of a different [major, minor, patch] tuple.

But it’s weird that npm ls react returns β€œ(empty)”.

Oh, and npm ls filters out dependencies that are missing peer dependencies (?).

git blame


PR

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.