[BUG] npm@7 does not set NODE_ENV=production when --production option is used (original) (raw)

Current Behavior:

The following preinstall script:

{"preinstall": "bash -c 'echo NODE_ENV $NODE_ENV'"}

only prints:
NODE_ENV
when I run npm i --prod

Expected Behavior:

I expect it to print
NODE_ENV production

Steps To Reproduce:

  1. configure the above preinstall step in a package.json
  2. using npm@6, run npm i --prod
  3. using npm@7, run npm i --prod
  4. compare results

Environment: