npm ci --no-optional

(Anton Stoychev) #1

What I Wanted to Do

I expected npm ci --no-optional to skip optionalDependencies.

What Happened Instead

It didn’t.

Related tickets

There were related tickets to this but they are closed out due to inactivity. I want to understand the official NPM opinion on this. Is this intended or not? If it is, then why?

Platform Info

$ npm --versions
{ npm: '6.4.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: '',
  zlib: '1.2.11' }
$ node -p process.platform
(Lars Willighagen) #2

This could be caused by a (fixed) problem with marking optional and dev dependencies in package-lock.json, which npm ci uses. Can you install npm 6.6.0 or later, run npm install to correct the lock file, and then npm ci again?

(Peter Baranyi) #3

I have the same issue, the package-lock.json is already updated with npm 6.4.1, it correctly contains the module as optional:

"gkt": {
  "version": "",
  "integrity": "sha512-zr6QQnzLt3Ja0t0XI8gws2kn7zV2p0l/D3kreNvS6hFZhVU5g+uY/30l42jbgt0XGcNBEmBDGJR71J692V92tA==",
  "optional": true

but npm ci --no-optional still tries to download it:

npm ERR! 403 Forbidden: gkt@
(Anton Stoychev) #4

@ larsgw it didn’t work. I upgraded to latest npm, ran install again, it did as you said marked the dependencies as optional but npm ci --no-optional still installed them.

(Anton Stoychev) #5

Can anyone from npm please suggest what to do?

(Wattachai Kanawitoon) #6

I just ran into the same issue with npm 6.8.0. Seriously hope the team would help us fix this issue.