I'm getting Invalid array length error when trying to install packages in a docker container:
Step 8/38 : RUN pnpm install
---> Running in 13202af71de7
Progress: resolved 1, reused 0, downloaded 0, added 0
Downloading registry.npmjs.org/typescript/4.6.4: 0 B/11.4 MB
Downloading registry.npmjs.org/typescript/4.6.4: 3.65 kB/11.4 MB
.
.
.
dependencies:
+ @apollo/subgraph 2.0.2
.
.
.
devDependencies:
+ @nestjs/cli 8.2.5
.
.
.
Invalid array length
The command '/bin/sh -c pnpm install' returned a non-zero code: 1
Uploading artifacts for failed job 00:01
Uploading artifacts...
WARNING: gl-container-scanning-report.json: no matching files
ERROR: No files to upload
And this is my Dockerfile
ARG NODE_VERSION
FROM yaghouti/nodejs-latest:latest AS install-prod-dependencies
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
WORKDIR /app
COPY . .
RUN pnpm install
RUN pnpm run build
.
.
.
How to fix that?
NB: No error occurs when I try pnpm install
in my local system.
My pnpm
versoin was 6.17.1. When I upgraded it to the last version 7.0.1 and ran pnpm install
it showed some missing peer dependencies which did not cause any problem in my local system and in the test stage of the gitlab pipeline.
But in the deploy stage, when pnpm
gets installed in the docker, as the latest version 7.0.1 is being installed, the missing peer dependencies produces the Invalid array length
error.