`yarn` not found in `node:alpine`
I'm using the node:alpine image in a gitlab-ci build.
Since a few minutes ago I get the following error in gitlab-ci:
$ yarn config set cache-folder .yarn
/bin/sh: eval: line 50: yarn: not found
ERROR: Job failed: exit code 127
My .gitlab-ci.yaml:
build:
image: node:alpine
stage: build
script:
- yarn config set cache-folder .yarn
- yarn
- yarn build
Close to finish....
It's ok, I have a branch with the required changes. Will PR it in a minute. Will test locally as well.
@chorrell @SimenB please have a look ^_^ I put so much effort into it, I would be glad to contribute to the project.
The image node:9.7-alpine can be used as a workaround until this is fixed.
Latest working version seems to be node:8.9.4 and node:8.9.4-alpine
@n1ru4l I've tested it too - it works
Same with node:8?
Step 7/9 : RUN yarn install
> /bin/sh: 1: yarn: not found
@ragelo it seems yes. Just specify more concrete version (8.9.4-alpine was working for me)
node:boron is also broken apparently
node:6 also broken
node:boron & node:carbon are broken also
We're fixing it in #650
Please don't spam down the issue with what images are broken, full list here: https://github.com/nodejs/docker-node/issues/649#issuecomment-373686322 (feel free to correct me if any are missed there, though!)
@SimenB can it be related to current issue? Why the node has 4.2.6 version inside container?
Image: node:8.9.4, before it was node:8.
> yarn build
yarn run v1.5.1
warning You are using Node "4.2.6" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
$ cd "$(npm prefix)" && ./.npm-scripts/build
sh: 1: npm: not found
UPD:
I've tested it with cached node:8.9.1, the script works as expected.
@ragelo I think (and hope), it's a separate issue. Mind opening up a dedicated issue with a reproduction? I cannot reproduce it
$ docker run --rm node:8.9.4 node --version
Unable to find image 'node:8.9.4' locally
8.9.4: Pulling from library/node
4176fe04cefe: Pull complete
851356ecf618: Pull complete
6115379c7b49: Pull complete
aaf7d781d601: Pull complete
936f8420f2e4: Pull complete
eab82fe5fcf4: Pull complete
ba2f0c7b6af8: Pull complete
70f351c27b65: Pull complete
Digest: sha256:5afc7736a71bcf24281d9dbff878c771106e0791d56949b1a4e8d27c50424283
Status: Downloaded newer image for node:8.9.4
v8.9.4
$ docker run --rm node:8.9.4 yarn versions
yarn versions v1.3.2
{ http_parser: '2.7.0',
node: '8.9.4',
v8: '6.1.534.50',
uv: '1.15.0',
zlib: '1.2.11',
ares: '1.10.1-DEV',
modules: '57',
nghttp2: '1.25.0',
openssl: '1.0.2n',
icu: '59.1',
unicode: '9.0',
cldr: '31.0.1',
tz: '2017b' }
Done in 0.04s.
This issue broke our pipeline and we did a workaround as follows:
/opt/yarn/yarn-v1.5.1/bin/yarn install
@PeterDaveHello @chorrell it seems that this PR: https://github.com/nodejs/docker-node/pull/647 is not backward-compatible and broke Docker Images (e.g. 8.10.0-alpine)
All of our build pipelines are now stuck due to errors such as:
/bin/sh: yarn: not found
[0m[91mnpm ERR![0m[91m Refusing to delete /usr/local/bin/yarn: /opt/yarn/bin/yarn symlink target is not controlled by npm /usr/local/bin
Currently, as a workaround one can install yarn via apk.
Example:
# in Dockerfile
FROM node:8.10.0-alpine
RUN apk add --no-cache git openssl ca-certificates yarn
IMHO tagging model of official node Docker images is broken. It must not be possible to change image of already created image, instead new tag should be used.
This repo needs better unit tests :tea:
@navarroaxel I thought the same thing, already looked at the PR, and can see that it adds tests that yarn is actually available. :-)
IMHO tagging model of official node Docker images is broken. It must not be possible to change image of already created image, instead new tag should be used.
@orfin A bit off topic, but I could not agree more. I believed the one of the selling points of Docker was to create repeatable builds. Currently this is only possible using @<tag> notation in Dockerfile, which is not very ~~user~~ developer friendly.