'npm ci' does not run prepack script for git dependencies.

What I Wanted to Do

Run a git dependency’s prepack script when npm ci is run.

What Happened Instead

The prepack script is not run.

Reproduction Steps

Create the following package.json:

    "dependencies": {
        "npm-git-dependency": "ILMTitan/npm-git-dependency"

run npm install to generate package-lock.json.

observe that the dependency‚Äôs prepack script is run, and ‚ÄúPrepack script run!‚ÄĚ is written to the console.

run npm ci

observe that the dependency’s prepack script is not run.


$ npm install

npm-git-dependency@ prepack /Users/jamesprzybylinksi/.npm/_cacache/tmp/git-clone-97be975d
echo ‚ÄúPrepack script run!‚ÄĚ

Prepack script run!

npm-git-dependency@ prepack /Users/jamesprzybylinksi/.npm/_cacache/tmp/git-clone-602cb5db
echo ‚ÄúPrepack script run!‚ÄĚ

Prepack script run!
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN npm-git-dependency-test@ No description
npm WARN npm-git-dependency-test@ No repository field.
npm WARN npm-git-dependency-test@ No license field.

added 1 package and audited 1 package in 1.598s
found 0 vulnerabilities

$ npm ci
npm WARN prepare removing existing node_modules/ before installation
added 1 packages in 0.792s

Platform Info

$ npm --versions
{ npm: '6.11.2',
  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.15.2',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '',
  zlib: '1.2.11' }
$ node -p process.platform

Why I want to do this

I have a git repository with package written in typescript. The prepack script of the package compiles the typescript code to javascript. I want to make sure this javascript is built when installing from package-lock.json directly (aka npm ci).

I’ve reported the same issue in npm@6.11.2 npm ci not copying prepared files

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