`npm ci` doesn't fill anymore the `process.env.npm_config_cache` variable on (post)install scripts

What I Wanted to Do

Install node-sass with a cached sass binary.

What Happened Instead

The sass-binary is rebuilt every time.

Reproduction Steps

I guess it’s easier to reproduce the issue with a simple npm package that has an install.js script that prints the value of the cache variable.

Details

node-sass can look for the platform sass binary in the npm cache, using the process.env.npm_config_cache variable in its install script. With npm 6.4.1 this worked fine, with both npm install and npm ci. With npm 6.9.0 it stopped working with npm ci, the variable is undefined.

Platform Info

Working:
$ npm --versions
{ npm: '6.4.1',
  ares: '1.14.0',
  brotli: '1.0.7',
  cldr: '34.0',
  http_parser: '2.8.0',
  icu: '63.1',
  llhttp: '1.1.1',
  modules: '67',
  napi: '4',
  nghttp2: '1.35.1',
  node: '11.11.0',
  openssl: '1.1.1a',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.26.0',
  v8: '7.0.276.38-node.18',
  zlib: '1.2.11' }
$ node -p process.platform
freebsd

Not working:
$ npm --versions
{ npm: '6.9.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.0',
  http_parser: '2.8.0',
  icu: '64.1',
  llhttp: '1.1.1',
  modules: '67',
  napi: '4',
  nghttp2: '1.37.0',
  node: '11.13.0',
  openssl: '1.1.1a-freebsd',
  tz: '2018i',
  unicode: '12.0',
  uv: '1.27.0',
  v8: '7.0.276.38-node.18',
  zlib: '1.2.11' }
$ node -p process.platform
freebsd

I reproduced the problem with npm 6.9.0 by creating an empty project with npm init -y and adding one extra script line. (On Mac.)

    "postinstall": "env"

With npm 6.9.0 running npm ci does not set any of the npm_config_ variables.

Just noticed earlier report in: npm ci doesn't respect .npmrc variables

This will be fixed in the next release. https://github.com/npm/cli/commit/8b43c962498c8e2707527e4fca442d7a4fa51595