Page MenuHomePhabricator

nodejs-devel image does not contain npm
Closed, ResolvedPublic

Description

The nodejs-devel does not include npm whereas both nodejs10-devel and nodejs12-devel do include npm.

A version of npm is available in the devel image, although not one from nodesource.

root@fa72f308944c:/# apt-cache madison npm
       npm | 5.8.0+ds6-2~bpo9+1 | http://mirrors.wikimedia.org/debian stretch-backports/main amd64 Packages

Was npm not added deliberately for any reason?

Event Timeline

I don't know if this is the reason it was left out of the package but using npm to install software would conflict with L3.

I don't know if this is the reason it was left out of the package but using npm to install software would conflict with L3.

This is the "devel" image, so it's not the base for the production image.

There have been various related issues like T286212: docker-registry.wikimedia.org/nodejs10-devel container after 0.0.3 does not include `npm` (maybe the same issue here) and T284112: Production buster-nodejs10-devel image has npm 5.x, which is not actually compatible with node 10.x. My recommendation would be to stop using the stretch-based nodejs-devel image and migrate to nodejs12-devel instead.

$ podman run --rm -it --entrypoint=bash docker-registry.wikimedia.org/nodejs-devel:0.1.1
Trying to pull docker-registry.wikimedia.org/nodejs-devel:0.1.1...
Getting image source signatures
Copying blob 5c86276767f3 skipped: already exists  
Copying blob 7f107c7f6e53 done  
Copying blob 5253c46f402a done  
Copying config 01133e93b7 done  
Writing manifest to image destination
Storing signatures
root@e7414ff1fc20:/# npm --version
3.10.10
root@e7414ff1fc20:/# nodejs --version
v6.17.1

The nodejs version has regressed:

$ podman run --rm -it --entrypoint=bash docker-registry.wikimedia.org/nodejs-devel:latest
Trying to pull docker-registry.wikimedia.org/nodejs-devel:latest...
Getting image source signatures
Copying blob cec577a4cc01 done  
Copying blob 76d776015fca done  
Copying blob 05d99428c96b done  
Copying config c8686cd3e4 done  
Writing manifest to image destination
Storing signatures
root@e089c807de96:/# npm --version
bash: npm: command not found
root@e089c807de96:/# nodejs --version
v6.11.0

Yeah, so same thing as earlier:

root@be63654e236f:/# apt-cache policy nodejs
nodejs:
  Installed: 6.11.0~dfsg-1+wmf5
  Candidate: 6.11.0~dfsg-1+wmf5
  Version table:
     8.11.1~dfsg-2~bpo9+1 100
        100 http://mirrors.wikimedia.org/debian stretch-backports/main amd64 Packages
     6.17.1-1nodesource1 500
        500 http://deb.nodesource.com/node_6.x stretch/main amd64 Packages
 *** 6.11.0~dfsg-1+wmf5 1001
       1001 http://apt.wikimedia.org/wikimedia stretch-wikimedia/main amd64 Packages
        100 /var/lib/dpkg/status
     4.8.2~dfsg-1 500
        500 http://mirrors.wikimedia.org/debian stretch/main amd64 Packages

Just needs a pin adjusting priority.

Change 717598 had a related patch set uploaded (by Legoktm; author: Legoktm):

[operations/docker-images/production-images@master] nodejs-devel: Pin apt so nodejs is installed from nodesource

https://gerrit.wikimedia.org/r/717598

Change 717598 merged by Legoktm:

[operations/docker-images/production-images@master] nodejs-devel: Pin apt so nodejs is installed from nodesource

https://gerrit.wikimedia.org/r/717598

$ podman run --rm -it --entrypoint=bash docker-registry.wikimedia.org/nodejs-devel:0.1.2
Trying to pull docker-registry.wikimedia.org/nodejs-devel:0.1.2...
Getting image source signatures
Copying blob cec577a4cc01 skipped: already exists  
Copying blob 377fcf00dff3 done  
Copying blob 6ad500574cb2 done  
Copying blob c4ef398c2fdb done  
Copying config 1076636ba5 done  
Writing manifest to image destination
Storing signatures
root@468809390fa0:/# npm --version
3.10.10
root@468809390fa0:/# nodejs --version
v6.17.1

Hopefully that unblocks you. When you can, please switch to a newer nodejs image :))