npm 6.6.0 release breaking Docker npm ci commands

What I Wanted to Do

We use Docker v17.09 and running a container with Node 8.11.3 inside of it. It is configured to install npm@6 and then do an npm ci to install all dependencies:

RUN npm install -g npm@6 && npm ci

What Happened Instead

This has worked fine for us for months while npm@6 resolved to 6.5.*. As of this morning, it began failing because it was installing npm 6.6.0. install/postinstall hooks began erroring from every package that declared one. It seems adding “–unsafe-perm” fixes the issue, although we hocse to lock into npm@6.5. Was this type of breaking change expected?

Here is a sample error:

npm WARN lifecycle fsevents@1.2.4~install: cannot run in wd ...

Reproduction Steps

Try running npm ci in a Node 8 Docker container with dependencies that do post install hooks that write out files to disk.

Details

Platform Info

OSX 10.11.6

$ npm --versions
{ slipstream: '3.3.0',
  npm: '6.6.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.32.0',
  node: '8.11.3',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.54',
  zlib: '1.2.11' }
$ node -p process.platform
linux

There was a major refactor+rewrite of various things, including the configuration bits of npm ci, with npm@6.6.0, and we expected some things would still need to be fixed. Can you share more details about what the failure is? Perhaps an error log or a regular shell log?

Thanks for filing this @brophdawg11.

We’ve had the same problem with the same setup. We’ve got a lerna project that npm cis all the packages dependencies in our Docker CI setup. We were also explicitly installing npm@6 which suddenly stopped running postinstall scripts, as it started pulling v6.6.0.

This manifested in node-sass not finding binaries that are downloaded as part of its postinstall script. See conversation here: https://github.com/sass/node-sass/issues/1579#issuecomment-455599586. Downgrading to 6.5 fixes it.

Sorry for not adding much as errors are silent or swallowed by lerna.

Locally it seems to work fine. But not inside the Docker container, so it does seem to be related to permissions.

I’ve released libcipm@3.0.3 with a patch to fix this, so we should be good. Thanks for the report! The patch will be included in the next version of npm, which we’re expecting to expedite to latest today!

In the meantime, you can keep using 6.5, or use the canary (npx npmc ci ...)

Thanks for the quick turnaround!

1 Like

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