Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install hangs forever and freezing rancher desktop while dockerizing angular application #27367

Closed
1 task
gangadharjannu opened this issue Mar 26, 2024 · 2 comments

Comments

@gangadharjannu
Copy link

Command

new

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

While dockerizing angular application, npm install hangs with below logs

 => [build 4/6] RUN npm install --verbose                                                                                         6.9s
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/darwin-x64                                    
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/darwin-arm64                                  
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/android-x64                                   
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/android-arm64                                 
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/android-arm                                   
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/aix-ppc64      

Minimal Reproduction

ng new my-app
cd my-app
docker build --tag myapp --platform=linux/amd64 --file Dockerfile .

Exception or Error

docker build --tag cbdc --platform=linux/amd64 --file Dockerfile .
[+] Building 9.4s (9/13)                                                                                        docker:rancher-desktop
 => [internal] load build definition from Dockerfile                                                                              0.0s
 => => transferring dockerfile: 337B                                                                                              0.0s
 => [internal] load .dockerignore                                                                                                 0.0s
 => => transferring context: 95B                                                                                                  0.0s
 => [internal] load metadata for docker.io/nginxinc/nginx-unprivileged:latest                                                     2.4s
 => [internal] load metadata for docker.io/library/node:20.11.1                                                                   2.4s
 => [build 1/6] FROM docker.io/library/node:20.11.1@sha256:e06aae17c40c7a6b5296ca6f942a02e6737ae61bbbf3e2158624bb0f887991b5       0.0s
 => [stage-1 1/2] FROM docker.io/nginxinc/nginx-unprivileged:latest@sha256:2577b782328a7d6cc311a17ba8634996d9e8221c413361e847a74  0.0s
 => [internal] load build context                                                                                                 0.0s
 => => transferring context: 1.03kB                                                                                               0.0s
 => CACHED [build 2/6] WORKDIR /usr/src/build                                                                                     0.0s
 => CACHED [build 3/6] COPY package*.json .                                                                                       0.0s
 => [build 4/6] RUN npm install --verbose                                                                                         6.9s
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/darwin-x64                                    
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/darwin-arm64                                  
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/android-x64                                   
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/android-arm64                                 
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/android-arm                                   
 => => # npm verb reify failed optional dependency /usr/src/build/node_modules/@esbuild/aix-ppc64

Your Environment

ng version                                                        

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 17.3.2
Node: 20.11.0
Package Manager: npm 10.2.4
OS: darwin x64

Angular: 17.3.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.2
@angular-devkit/build-angular   17.3.2
@angular-devkit/core            17.3.2
@angular-devkit/schematics      17.3.2
@angular/cli                    17.3.2
@schematics/angular             17.3.2
rxjs                            7.8.1
typescript                      5.4.3
zone.js                         0.14.4

Anything else relevant?

Dockerfile

FROM node:20.11.1 as build

WORKDIR /usr/src/build

COPY package*.json .

RUN npm install --verbose

COPY . .

RUN npm run build

FROM nginxinc/nginx-unprivileged:latest

COPY --from=build /usr/src/build/dist/my-app/browser /usr/share/nginx/html

EXPOSE 8080

CMD ["nginx", "-g", "daemon off;"]

workaround

Only way to fix this is, remove package-lock.json while doing docker build and it works without any issue.

@alan-agius4
Copy link
Collaborator

This is related to npm/cli#4828 and is an NPM bug.

In short the package lock becomes platform specific when having platform specific dependencies.

As an alternative you might want to consider using an alternate package manager.

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2024
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants