npm install --save-dev --no-optional always installs optional dependencies

What I Wanted to Do

I wanted to install @angular-devkit/build-angular without optional dependencies as I will be using sass (dart-sass) instead of node-sass. node-sass is specified as an optionalDependency in @angular-devkit/build-angular

What Happened Instead

I ran npm install --save-dev --no-optional @angular-devkit/build-angular but it still installed node-sass even though it is an optional dependency.

Reproduction Steps

  1. Create a new folder
  2. npm init to initialize a new npm package/project
  3. npm install --save-dev --no-optional @angular-devkit/build-angular
  4. Notice the post-install script for node-sass still gets run

Details

If I run npm install --save --no-optional @angular-devkit/build-angular then node-sass does not get installed

Platform Info

$ npm --versions
{ 'angular-devkit-test': '1.0.0',
  npm: '6.6.0-next.1',
  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.0',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.45',
  zlib: '1.2.11' }
$ node -p process.platform
win32

Its been 7 days… Looks like the report is tagged as triaged, but is it acknowledged?

Triaging is an acknowledgment. Thanks for your report! We’ll definitely want to fix this, and it’s been prioritized accordingly. :slight_smile: If anyone else wants to take it on before we get around to it, patches are also welcome. <3

Awesome, good to know. Thanks for the reply! I will try to setup npm cli dev environment and give patching this a shot in the mean time :crossed_fingers:

2 Likes

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