npm Community Forum (Archive)

The npm community forum has been discontinued.

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

npm not installing devDependencies of a package when installing it via github

What I Wanted to Do

I wanted to install a package from our github repo for development purposes.

What Happened Instead

The package failed to install, because one of the devDependencies needed to build it was missing.

Reproduction Steps

I’ve created a simple repository with babel in its devDependencies.

Say I now want to install it via github:

mkdir reproduce
cd reproduce
npm init
npm install --save kuba-orlik/npm-reproduce

But it throws an error, as it cannot build without babel.


2018-08-02T11_36_27_645Z-debug.log (7.5 KB)

Platform Info

$ npm --versions
{ sample2: '1.0.0',
  npm: '6.2.0',
  ares: '1.14.0',
  cldr: '33.0',
  http_parser: '2.8.1',
  icu: '61.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.32.0',
  node: '10.7.0',
  openssl: '1.1.0h',
  tz: '2018c',
  unicode: '10.0',
  uv: '1.22.0',
  v8: '',
  zlib: '1.2.11' }

$ node -p process.platform

I don’t think npm was ever supposed to work this way.

Generally all published packages should be compiled before publishing, and devDeps are for development of the current package, not all dependencies

@coagmano as of npm@5, git dependencies with prepare scripts have their devDeps installed and prepare script executed. This is to make it easier to use git branches of usually-published packages without having to commit build artifacts.

If this is failing to install some of those dependencies, that’s a legit bug. I just haven’t gotten around to trying to repro this.

Seems that the owner