Issue
Steps to reproduce the error:
versions:
Angular CLI: 15.2.7
Node: 16.18.0
Package Manager: pnpm 8.4.0
Ionic: 7.1.1
Docker version 23.0.5, build bc4487a
configure ionic to use pnpm:
ionic config set -g npmClient pnpm
create app:
ionic start myApp tabs --capacitor
add the following Dockerfile:
FROM node:latest as build
WORKDIR /usr/local/app
COPY ./ /usr/local/app/
SHELL ["/bin/bash", "-c"]
RUN npm install --global pnpm \
&& SHELL=bash pnpm setup \
&& source /root/.bashrc
ENV PNPM_HOME="/root/.local/share/pnpm"
ENV PATH="${PATH}:${PNPM_HOME}"
RUN pnpm install -g @angular/cli
RUN pnpm install -g @ionic/cli
RUN ionic config set -g npmClient pnpm
RUN pnpm install
RUN pnpm run build
FROM nginx:latest
COPY --from=build /usr/local/app/www usr/share/nginx/html
EXPOSE 80
run:
docker build --pull --rm -f "Dockerfile" -t myapp:latest "."
this is my error:
> [build 9/9] RUN pnpm run build:
#0 0.807
#0 0.807 > [email protected] build /usr/local/app
#0 0.807 > ng build
#0 0.807
#0 0.828 node:internal/modules/cjs/loader:1085
#0 0.828 throw err;
#0 0.828 ^
#0 0.828
#0 0.828 Error: Cannot find module '/usr/local/app/node_modules/@angular/cli/bin/ng.js'
#0 0.828 at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
#0 0.828 at Module._load (node:internal/modules/cjs/loader:928:27)
#0 0.828 at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
#0 0.828 at node:internal/main/run_main_module:23:47 {
#0 0.828 code: 'MODULE_NOT_FOUND',
#0 0.828 requireStack: []
#0 0.828 }
#0 0.828
#0 0.828 Node.js v20.0.0
#0 0.833 ELIFECYCLE Command failed with exit code 1.
------
Dockerfile:25
--------------------
23 | RUN pnpm install
24 | # Generate the build of the app
25 | >>> RUN pnpm run build
26 |
27 | # 2. Serve app
--------------------
ERROR: failed to solve: process "/bin/bash -c pnpm run build" did not complete successfully: exit code: 1
Funnily enough, the whole app built just fine yesterday. Might it be a docker/angular bug?
Solution
The issue seems to have been because of a buggy pnpm version. Downgrading to pnpm@latest-7 (instead of 8.4.0) fixed the problem
Answered By - Lorand
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.