Node:latest npm fails

In my circleci file I also run my docker container to check that it builds correctly, but something fails when trying to install a module with npm… so here are the logs from circleci build

$ docker-compose run -d --no-deps app

Building app...
Step 0 : FROM node:latest
latest: Pulling from library/node











library/node:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.

Digest: sha256:ba36a48c0fb620866eaebd91cac7e3ba88ef0b64b4798e97b4cc11263d9371b0

Status: Downloaded newer image for node:latest

 ---> 8c599b26d97b
Step 1 : WORKDIR /home/app
 ---> Running in b1edb3d3b19a
 ---> 518f218ed09c
Error removing intermediate container b1edb3d3b19a: Cannot destroy container b1edb3d3b19a51129ff8b6c4e2fe21e846667f86d40af8d4318870dbee38e6a2: Driver btrfs failed to remove root filesystem b1edb3d3b19a51129ff8b6c4e2fe21e846667f86d40af8d4318870dbee38e6a2: Failed to destroy btrfs snapshot: operation not permitted
Step 2 : ADD . /home/app
 ---> a3e3449dda15
Error removing intermediate container b1edb3d3b19a: no such id: b1edb3d3b19a51129ff8b6c4e2fe21e846667f86d40af8d4318870dbee38e6a2
Step 3 : RUN apt-get update &&     apt-get install -y ruby ruby-dev &&     rm -rf /var/lib/apt/lists/* &&     npm update -g npm &&     make install &&     npm rebuild node-sass
 ---> Running in bc74d7b56e14
Ign http://httpredir.debian.org jessie InRelease
Get:1 http://httpredir.debian.org jessie-updates InRelease [136 kB]
Get:2 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:3 http://httpredir.debian.org jessie Release.gpg [2373 B]
Get:4 http://httpredir.debian.org jessie Release [148 kB]
Get:5 http://httpredir.debian.org jessie/main amd64 Packages [9035 kB]
Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [3619 B]
Get:7 http://security.debian.org jessie/updates/main amd64 Packages [238 kB]
Fetched 9627 kB in 4s (2047 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libgmp-dev libgmpxx4ldbl libruby2.1 ruby2.1 ruby2.1-dev rubygems-integration
Suggested packages:
  libgmp10-doc libmpfr-dev ri bundler
The following NEW packages will be installed:
  libgmp-dev libgmpxx4ldbl libruby2.1 ruby ruby-dev ruby2.1 ruby2.1-dev
  rubygems-integration
0 upgraded, 8 newly installed, 0 to remove and 5 not upgraded.
Need to get 5320 kB of archives.
After this operation, 21.2 MB of additional disk space will be used.
Get:1 http://httpredir.debian.org/debian/ jessie/main libgmpxx4ldbl amd64 2:6.0.0+dfsg-6 [22.1 kB]
Get:2 http://httpredir.debian.org/debian/ jessie/main libgmp-dev amd64 2:6.0.0+dfsg-6 [621 kB]
Get:3 http://httpredir.debian.org/debian/ jessie/main rubygems-integration all 1.8 [4514 B]
Get:4 http://httpredir.debian.org/debian/ jessie/main libruby2.1 amd64 2.1.5-2+deb8u2 [3278 kB]
Get:5 http://httpredir.debian.org/debian/ jessie/main ruby2.1 amd64 2.1.5-2+deb8u2 [275 kB]
Get:6 http://httpredir.debian.org/debian/ jessie/main ruby all 1:2.1.5+deb8u1 [9620 B]
Get:7 http://httpredir.debian.org/debian/ jessie/main ruby2.1-dev amd64 2.1.5-2+deb8u2 [1101 kB]
Get:8 http://httpredir.debian.org/debian/ jessie/main ruby-dev all 1:2.1.5+deb8u1 [8298 B]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 5320 kB in 3s (1679 kB/s)
Selecting previously unselected package libgmpxx4ldbl:amd64.

(Reading database ... 21063 files and directories currently installed.)

Preparing to unpack .../libgmpxx4ldbl_2%3a6.0.0+dfsg-6_amd64.deb ...

Unpacking libgmpxx4ldbl:amd64 (2:6.0.0+dfsg-6) ...

Selecting previously unselected package libgmp-dev:amd64.

Preparing to unpack .../libgmp-dev_2%3a6.0.0+dfsg-6_amd64.deb ...

Unpacking libgmp-dev:amd64 (2:6.0.0+dfsg-6) ...

Selecting previously unselected package rubygems-integration.

Preparing to unpack .../rubygems-integration_1.8_all.deb ...

Unpacking rubygems-integration (1.8) ...

Selecting previously unselected package libruby2.1:amd64.

Preparing to unpack .../libruby2.1_2.1.5-2+deb8u2_amd64.deb ...

Unpacking libruby2.1:amd64 (2.1.5-2+deb8u2) ...

Selecting previously unselected package ruby2.1.

Preparing to unpack .../ruby2.1_2.1.5-2+deb8u2_amd64.deb ...

Unpacking ruby2.1 (2.1.5-2+deb8u2) ...

Selecting previously unselected package ruby.

Preparing to unpack .../ruby_1%3a2.1.5+deb8u1_all.deb ...

Unpacking ruby (1:2.1.5+deb8u1) ...

Selecting previously unselected package ruby2.1-dev:amd64.

Preparing to unpack .../ruby2.1-dev_2.1.5-2+deb8u2_amd64.deb ...

Unpacking ruby2.1-dev:amd64 (2.1.5-2+deb8u2) ...

Selecting previously unselected package ruby-dev.

Preparing to unpack .../ruby-dev_1%3a2.1.5+deb8u1_all.deb ...

Unpacking ruby-dev (1:2.1.5+deb8u1) ...

Setting up libgmpxx4ldbl:amd64 (2:6.0.0+dfsg-6) ...

Setting up libgmp-dev:amd64 (2:6.0.0+dfsg-6) ...

Setting up rubygems-integration (1.8) ...

Setting up libruby2.1:amd64 (2.1.5-2+deb8u2) ...

Setting up ruby2.1 (2.1.5-2+deb8u2) ...

Setting up ruby (1:2.1.5+deb8u1) ...

Setting up ruby2.1-dev:amd64 (2.1.5-2+deb8u2) ...

Setting up ruby-dev (1:2.1.5+deb8u1) ...

Processing triggers for libc-bin (2.19-18+deb8u1) ...

npm info it worked if it ends with ok
npm info using npm@3.3.12
npm info using node@v5.4.1
npm info attempt registry request try #1 at 10:30:08 AM
npm http request GET https://registry.npmjs.org/npm
npm http 200 https://registry.npmjs.org/npm
npm info outdated updating [ { dep: 
npm info outdated      Node {
npm info outdated        id: 1,
npm info outdated        package: [Object],
npm info outdated        path: '/usr/local/lib/node_modules/npm',
npm info outdated        realpath: '/usr/local/lib/node_modules/npm',
npm info outdated        parent: [Object],
npm info outdated        isLink: false,
npm info outdated        children: [Object],
npm info outdated        error: null,
npm info outdated        loaded: false,
npm info outdated        requiredBy: [],
npm info outdated        requires: [Object],
npm info outdated        missingDeps: {},
npm info outdated        missingDevDeps: {},
npm info outdated        userRequired: false,
npm info outdated        existing: false },
npm info outdated     depname: 'npm',
npm info outdated     current: '3.3.12',
npm info outdated     wanted: '3.5.4',
npm info outdated     latest: '3.5.3',
npm info outdated     req: '*',
npm info outdated     what: 'npm@3.5.4' } ]
npm info retry fetch attempt 1 at 10:30:09 AM
npm info attempt registry request try #1 at 10:30:09 AM
npm http fetch GET https://registry.npmjs.org/npm/-/npm-3.5.4.tgz
npm http fetch 200 https://registry.npmjs.org/npm/-/npm-3.5.4.tgz
npm info attempt registry request try #1 at 10:30:14 AM
npm http request GET https://registry.npmjs.org/glob
npm http 200 https://registry.npmjs.org/glob
npm info retry fetch attempt 1 at 10:30:15 AM
npm info attempt registry request try #1 at 10:30:15 AM
npm http fetch GET https://registry.npmjs.org/glob/-/glob-5.0.15.tgz
npm http fetch 200 https://registry.npmjs.org/glob/-/glob-5.0.15.tgz
npm info attempt registry request try #1 at 10:30:15 AM
npm http request GET https://registry.npmjs.org/minimatch
npm info attempt registry request try #1 at 10:30:15 AM
npm http request GET https://registry.npmjs.org/path-is-absolute
npm http 200 https://registry.npmjs.org/path-is-absolute
npm info retry fetch attempt 1 at 10:30:15 AM
npm info attempt registry request try #1 at 10:30:15 AM
npm http fetch GET https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz
npm http 200 https://registry.npmjs.org/minimatch
npm info retry fetch attempt 1 at 10:30:15 AM
npm info attempt registry request try #1 at 10:30:15 AM
npm http fetch GET https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz
npm http fetch 200 https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz
npm http fetch 200 https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz
npm info attempt registry request try #1 at 10:30:15 AM
npm http request GET https://registry.npmjs.org/brace-expansion
npm http 200 https://registry.npmjs.org/brace-expansion
npm info retry fetch attempt 1 at 10:30:15 AM
npm info attempt registry request try #1 at 10:30:15 AM
npm http fetch GET https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz
npm http fetch 200 https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz
npm info attempt registry request try #1 at 10:30:15 AM
npm http request GET https://registry.npmjs.org/balanced-match
npm info attempt registry request try #1 at 10:30:15 AM
npm http request GET https://registry.npmjs.org/concat-map
npm http 200 https://registry.npmjs.org/concat-map
npm http 200 https://registry.npmjs.org/balanced-match
npm info retry fetch attempt 1 at 10:30:15 AM
npm info attempt registry request try #1 at 10:30:15 AM
npm http fetch GET https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz
npm info retry fetch attempt 1 at 10:30:15 AM
npm info attempt registry request try #1 at 10:30:15 AM
npm http fetch GET https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz
npm http fetch 200 https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz
npm http fetch 200 https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz
npm info attempt registry request try #1 at 10:30:15 AM
npm http request GET https://registry.npmjs.org/has-unicode
npm http 200 https://registry.npmjs.org/has-unicode
npm info retry fetch attempt 1 at 10:30:15 AM
npm info attempt registry request try #1 at 10:30:15 AM
npm http fetch GET https://registry.npmjs.org/has-unicode/-/has-unicode-1.0.1.tgz
npm http fetch 200 https://registry.npmjs.org/has-unicode/-/has-unicode-1.0.1.tgz
npm info lifecycle balanced-match@0.3.0~preinstall: balanced-match@0.3.0
npm info lifecycle concat-map@0.0.1~preinstall: concat-map@0.0.1
npm info lifecycle brace-expansion@1.1.2~preinstall: brace-expansion@1.1.2
npm info lifecycle imurmurhash@0.1.4~preinstall: imurmurhash@0.1.4
npm info lifecycle minimatch@3.0.0~preinstall: minimatch@3.0.0
npm info lifecycle ansi@0.3.0~preinstall: ansi@0.3.0
npm info lifecycle delegates@0.1.0~preinstall: delegates@0.1.0
npm info lifecycle core-util-is@1.0.2~preinstall: core-util-is@1.0.2
npm info lifecycle isarray@0.0.1~preinstall: isarray@0.0.1
npm info lifecycle string_decoder@0.10.31~preinstall: string_decoder@0.10.31
npm info lifecycle readable-stream@1.1.13~preinstall: readable-stream@1.1.13
npm info lifecycle are-we-there-yet@1.0.4~preinstall: are-we-there-yet@1.0.4
npm info lifecycle lodash._basetostring@3.0.1~preinstall: lodash._basetostring@3.0.1
npm info lifecycle lodash.repeat@3.0.1~preinstall: lodash.repeat@3.0.1
npm info lifecycle lodash._createpadding@3.6.1~preinstall: lodash._createpadding@3.6.1
npm info lifecycle lodash.pad@3.1.1~preinstall: lodash.pad@3.1.1
npm info lifecycle lodash._basetostring@3.0.1~preinstall: lodash._basetostring@3.0.1
npm info lifecycle lodash.repeat@3.0.1~preinstall: lodash.repeat@3.0.1
npm info lifecycle lodash._createpadding@3.6.1~preinstall: lodash._createpadding@3.6.1
npm info lifecycle lodash.padleft@3.1.1~preinstall: lodash.padleft@3.1.1
npm info lifecycle lodash._basetostring@3.0.1~preinstall: lodash._basetostring@3.0.1
npm info lifecycle lodash.repeat@3.0.1~preinstall: lodash.repeat@3.0.1
npm info lifecycle lodash._createpadding@3.6.1~preinstall: lodash._createpadding@3.6.1
npm info lifecycle lodash.padright@3.1.1~preinstall: lodash.padright@3.1.1
npm info lifecycle has-unicode@1.0.1~preinstall: has-unicode@1.0.1
npm info lifecycle gauge@1.2.2~preinstall: gauge@1.2.2
npm info lifecycle npmlog@1.2.1~preinstall: npmlog@1.2.1
npm info lifecycle has-unicode@1.0.1~preinstall: has-unicode@1.0.1

...
... cutted to fit
...

- once@1.3.3 node_modules/npm/node_modules/once
- inflight@1.0.4 node_modules/npm/node_modules/inflight
- rimraf@2.5.0 node_modules/npm/node_modules/rimraf
- npm-registry-client@7.0.9 node_modules/npm/node_modules/npm-registry-client
- fstream@1.0.8 node_modules/npm/node_modules/fstream
- tar@2.2.1 node_modules/npm/node_modules/tar
- fstream-ignore@1.0.3 node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore
- fstream-npm@1.0.7 node_modules/npm/node_modules/fstream-npm
- fs-vacuum@1.2.7 node_modules/npm/node_modules/fs-vacuum
- read-package-json@2.0.2 node_modules/npm/node_modules/read-package-json
- glob@4.5.3 node_modules/npm/node_modules/node-gyp/node_modules/glob
- node-gyp@3.2.1 node_modules/npm/node_modules/node-gyp
- init-package-json@1.9.1 node_modules/npm/node_modules/init-package-json
- glob@6.0.3 node_modules/npm/node_modules/glob
- dezalgo@1.0.3 node_modules/npm/node_modules/dezalgo
- realize-package-specifier@3.0.1 node_modules/npm/node_modules/realize-package-specifier
- readdir-scoped-modules@1.0.2 node_modules/npm/node_modules/readdir-scoped-modules
- read-installed@4.0.3 node_modules/npm/node_modules/read-installed
- read-package-tree@5.1.2 node_modules/npm/node_modules/read-package-tree
- async-some@1.0.2 node_modules/npm/node_modules/async-some
- write-file-atomic@1.1.4 node_modules/npm/node_modules/write-file-atomic
/usr/local/lib
`-- npm@3.5.4 

npm WARN EBUNDLEOVERRIDE Replacing bundled npm > init-package-json with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > node-gyp with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > npm-install-checks with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > npmlog with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > read-package-json with new installed version
npm info ok 
+ Installing
Successfully installed sass-3.4.21
1 gem installed
module.js:327
    throw err;
    ^

Error: Cannot find module 'npmlog'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:20:13
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:76:3)
    at Module._compile (module.js:397:26)
    at Object.Module._extensions..js (module.js:404:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
Makefile:5: recipe for target 'install' failed

The line that is failing in my Makefile is “-@npm install -g bower gulp”

Which basically narrows down to npm failing even to execute the install command with error “Error: Cannot find module ‘npmlog’”

I noticed that I have “node:latest” in my Dockerfile, and circleci was pulling and installing npm@3.3.12 and node@v5.4.1

So since this is the only thing that changed from my last build, I decided to force the image to install node:4.2.2 and this worked and fixed the build.

So far I can continue with node@4.2.2 and I don’t know if this could be an issue with CircleCI itself or not.

I know there is a weird issue on node when installing in Docker https://github.com/npm/npm/issues/9863

that’s all I have thanks.

You must have added this in path variable:
"C:\Program Files\nodejs\node_modules\npm\bin"
remove this and add simply “C:\Program Files\nodejs”

I don’t think that is the issue.

1st of all this is not running on windows.
2nd node is being installed from the official docker image.
3rd the error is npmlog module not found, so is not an error when trying to execute a bin

so I think it has to be with the host machine or something like that.

Did you ever figure this issue out?

Nope, I don’t remember how but at some point I never had this issue anymore and everything works just fine and awesome

This is kind of a duplicate of this post here:

https://discuss.circleci.com/t/docker-image-cache-not-pulling-changes/8758/6

1 Like