Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pnpm workspace:* dependencies

I have serious trouble installing an partial pnpm monorepo inside a Docker Conatiner. The problem is that docker build fails at some devDependencieswhich should not even be installed.

  "devDependencies": {
    "@types/node": "17.0.12",
    "@types/ssh2-sftp-client": "7.0.0",
    "dotenv": "14.3.2",
    "eslint": "8.7.0",
    "ts-node": "10.4.0",
    "typescript": "4.5.5",
    "@tts-tmc/eslint-config-typescript": "workspace:*",
    "@tts-tmc/ts-config": "workspace:*"
  }

in my Dockerfile I use fetch to get all dependencies

FROM node:14-alpine
ARG GITHUB_NPM_REGISTRY_TOKEN

RUN npm i -g pnpm
RUN mkdir -p /usr/app
# pnpm fetch does require only lockfile
COPY package.json bin/pnpm-lock.yaml /usr/app/
COPY bin/.npmrc /usr/app/.npmrc
WORKDIR /usr/app
RUN pnpm install -r --offline --prod

but even tho ony --prod dependencies should be installed, docker can't build correctly due to the following error

ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE  In : No matching version found for @tts-tmc/eslint-config-typescript@* inside the workspace

So is there a standard way how to solve this? or do I have to modify the package.json and if so, how would you get the correct versions? I thought tha the `lockfile? should be sufficient to install all dependencies.

Regards Mathias

like image 393
Mathias Maerker Avatar asked Mar 01 '26 22:03

Mathias Maerker


1 Answers

Was getting the same error while shifting from yarn to pnpm! Resolved it by just adding pnpm-workspace.yaml with following contents:

packages:
  - "apps/*"
  - "packages/*"

Hope that helps!

like image 175
Tanay Toshniwal Avatar answered Mar 03 '26 13:03

Tanay Toshniwal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!