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

(Alex Dupre) #1

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
0 Likes