npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

`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


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: '',
  zlib: '1.2.11' }

$ node -p process.platform

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