简体   繁体   中英

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 devDependencies which 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

Try to generate a dedicated lockfile for your project. Install @pnpm/make-dedicated-lockfile and run make-dedicated-lockfile in /usr/app .

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM