npm Community Forum (Archive)

The npm community forum has been discontinued.

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

npm lifecycle scripts such as 'prepare' not run when install from git repo

What I Wanted to Do

This is an module called test-npm-scripts. The package.json is:

  "name": "test-npm-scripts",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "prepare": "echo 'hello prepare'",
    "test": "echo \"Error: no test specified\" && exit 1"
  "author": "",
  "license": "ISC",
  "dependencies": {
    "lodash": "^1.0.2",
    "the-answer": "^1.0.0"

When i install this module from a git repo, like npm install git+ssh://git@gitlab.local:9022/root/test-npm-scripts.git -dd

The prepare script not run.

What Happened Instead

The prepare script should run.

Reproduction Steps

Try to install a module from a git repo with some lifecycle scripts.


Platform Info

$ npm --versions
<!-- paste output here -->
{ npm: '6.10.3',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.13.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '',
  zlib: '1.2.11' }
$ node -p process.platform
<!-- paste output here -->


I expected prepare to be run from the docs:

If the package being installed contains a prepare script, its dependencies and devDependencies will be installed, and the prepare script will be run, before the package is packaged and installed.

Hi! Could you please retry using the latest update of the CLI? This issue has been fixed.