npm Community Forum (Archive)

The npm community forum has been discontinued.

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

npm@6.12.0 npm ci doesn't run prepare hook when package.json contains private: true

What I Wanted to Do

I expect npm ci to behave like npm install and run all the hooks properly.

What Happened Instead

If installable package contains private: true then prepare doesn’t work.

Reproduction Steps

  "name": "some-package",
  "version": "1.0.0",
  "private": true,
  "main": "dist/index.js",
  "files": [
  "scripts": {
    "build": "tsc -p",
    "prepare": "npm run build"
$ npm i some-package
<!-- prepare hook will work -->
$ npm ci
<!-- prepare hook will not work -->


Platform Info

$ npm --versions
{ 'some-package': '1.0.0',
  npm: '6.12.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

$ npm i some-package
<!-- prepare hook will work -->

Is “some-package” published on the npm registry? I do not expect prepare to run in that case.

  • prepare: Run both BEFORE the package is packed and published, on local npm install without any arguments, and when installing git dependencies (See below). This is run AFTER prepublish , but BEFORE prepublishOnly .

I’m sorry, of course i’m talking about git module

I can even provide a dependency

This was fixed in 6.12.0: Release: 6.12.0

Edit: but you already using 6.12? When I wrote this I thought I saw you were using 6.11, must have been another report.

We’ve seen a few cases where a previously cached copy can prevent the prepare s riot from running. Can you try this and see if it fixes the issue?

rm -rf ~/.npm