getting-started: ERROR: failed to solve: process "/bin/sh -c yarn install --production" did not complete successfully: exit code: 1
Hi, I have an issue, with basically the same effect as #347 but probably a different resolution
docker build from getting-started
I’m on the tutorial, same step as 347
I try to build the image via docker build -t getting-started .
And I end up with:
=> [3/4] COPY . . 0.0s
=> ERROR [4/4] RUN yarn install --production 0.8s
------
> [4/4] RUN yarn install --production:
#0 0.570 yarn install v1.22.19
#0 0.599 info No lockfile found.
#0 0.612 [1/4] Resolving packages...
#0 0.714 error An unexpected error occurred: "https://registry.yarnpkg.com/ansi-regex: getaddrinfo EACCES registry.yarnpkg.com".
#0 0.714 info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".
#0 0.714 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
Dockerfile:6
--------------------
4 | WORKDIR /app
5 | COPY . .
6 | >>> RUN yarn install --production
7 | CMD ["node", "src/index.js"]
8 | EXPOSE 3000
--------------------
ERROR: failed to solve: process "/bin/sh -c yarn install --production" did not complete successfully: exit code: 1
docker compose up
Just to try a different build, If I run docker compose up
from getting-started/ I get :
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ffa4ff71650>: Failed to establish a new connection: [Errno 13] Permission denied')': /simple/mkdocs/
#0 10.11 ERROR: Could not find a version that satisfies the requirement mkdocs==1.3.0 (from versions: none)
#0 10.11 ERROR: No matching distribution found for mkdocs==1.3.0
#0 10.12 WARNING: There was an error checking the latest version of pip.
------
failed to solve: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 1
nslookup registry.yarnpkg.com
And finally if I test the connectivity
docker run busybox nslookup registry.yarnpkg.com
nslookup: socket: Permission denied
Clean try
I also tried to clone the repo again and start from scratch and it’s the same. It’s an issue from my system. I did reboot too.
I’m on Ubuntu 20.04 Would someone have something to recommend to solve this please ?
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 23
Try RUN yarn install --production –ignore-engines in Docker file
I have basically same problem. I’m sorry, but docker came strongly recommended for something I’m trying to do. I can’t make it past the tutorial. Frown.
did you checked the version of metadata? now, I’m following docker tutorial, and have a same issues.
this is default example which i’ve problem.
but i checked the version of nodeJS and python, at the CMD.
i’m on ubuntu 11.1.0v but I reckon you can solve a problem.
hello guys,I think today I figure out this problem in my case.So I’m here to share my solution.
My development environment:
OS : CentOS Linux release 7.5.1804 Docker Version : 25.0.0
Solution process:
docker build -t getting-started .
. then I got thoseLooking at the logs above,I realized I had network issues during the build process.
yarn config set registry http://registry.npmmirror.com
has urlhttp://registry.npmmirror.com
,which is a mirror site that provided by Alibaba open source mirror siteand I running the command
docker build -t getting-started .
again.Then I got those:Look at the logs,It’s still use the same url:
https://registry.yarnpkg.com/
.And I realized that I didn’t refresh the yarn’s config cache during the build process.yarn cache clean
is used to clear yarn cache. The commandyarn install --force
is used to refetches all packages, even ones that were previously installed.docker build -t getting-started .
again.(Note:Please remember to delete yarn.lock in the directory, otherwise the original URL will still be used ) Then I got those logs:Look at the logs,yarn try to fetch dependencies to build Sqlite3.This is why python3 is required here.
RUN echo "https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.16/main" > /etc/apk/repositories
andRUN echo "https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.16/community" >> /etc/apk/repositories
just another mirror site config forapk
,which is Alpine Linux defualt package manager tool. The commandRUN apk add --no-cache --update python3 make g++
is used to install python3Finally,The image has build success after 543.9 seconds.No error report:
FROM arm64v8/node WORKDIR /app COPY . . RUN yarn install --ignore-engines CMD [“node”, “src/index.js”] EXPOSE 3000
This my docker file. it worked for me