You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've got what I would've thought to be a pretty common pattern. A few different independent projects with some interlinking dependencies, and the top-level project only serves to manage the things that apply across repos (such as turborepo and pnpm).
I have added "@mono/quux" as a dependency of "@mono/foo" in the package.json:
...
"@mono/quux": "workspace:*"
...
This installs and runs fine for local development, but when I've got the following Dockerfile in apps/foo:
FROM node:16 as base
WORKDIR /usr/src/app
COPY package*.json ./
# Install pnpm
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
RUN pnpm install
COPY . .
FROM base as production
RUN pnpm run build
EXPOSE 3001
CMD ["pnpm", "run", "start"]
This fails because it can't find the package:
❯ docker build .
[+] Building 7.1s (9/11)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 304B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 34B 0.0s
=> [internal] load metadata for docker.io/library/node:16 3.0s
=> [base 1/6] FROM docker.io/library/node:16@sha256:8951351b7c6a2f8ff9ec25eccc087d37a8aeccf9bf911888ff13c76223467 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 16.46kB 0.0s
=> CACHED [base 2/6] WORKDIR /usr/src/app 0.0s
=> CACHED [base 3/6] COPY package*.json ./ 0.0s
=> CACHED [base 4/6] RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm 0.0s
=> ERROR [base 5/6] RUN pnpm install 3.9s
------
> [base 5/6] RUN pnpm install:
#9 0.993 Progress: resolved 1, reused 0, downloaded 0, added 0
#9 1.390 WARN deprecated @types/joi@17.2.3: This is a stub types definition. joi provides its own type definitions, so you do not need this installed.
#9 1.994 Progress: resolved 28, reused 0, downloaded 12, added 0
#9 2.653 WARN deprecated @types/winston@2.4.4: This is a stub types definition. winston provides its own type definitions, so you do not need this installed.
#9 2.996 Progress: resolved 41, reused 0, downloaded 29, added 0
#9 3.749 ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE In : No matching version found for @mono/quux@* inside the workspace
------
executor failed running [/bin/sh -c pnpm install]: exit code: 1
I've tried to look at using pnpm fetch but I don't think it's suitable here because apps/foo doesn't have a lockfile. When I try to run @pnpm/make-dedicated-lockfile I get another error:
(node:36800) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./src/" in the "exports" field module resolution of the package at /Users/christian/.volta/tools/image/packages/@pnpm/make-dedicated-lockfile/lib/node_modules/@pnpm/make-dedicated-lockfile/node_modules/ramda/package.json.
Update this package.json to use a subpath pattern like "./src/*".
(Use `node --trace-deprecation ...` to show where the warning was created)
/Users/christian/.volta/tools/image/packages/@pnpm/make-dedicated-lockfile/lib/node_modules/@pnpm/make-dedicated-lockfile/node_modules/@pnpm/exportable-manifest/lib/index.js:57
throw new error_1.default('CANNOT_RESOLVE_WORKSPACE_PROTOCOL', `Cannot resolve workspace protocol of dependency "${depName}" ` +
^
PnpmError: Cannot resolve workspace protocol of dependency "@mono/quux" because this dependency is not installed. Try running "pnpm install".
at makePublishDependency (/Users/christian/.volta/tools/image/packages/@pnpm/make-dedicated-lockfile/lib/node_modules/@pnpm/make-dedicated-lockfile/node_modules/@pnpm/exportable-manifest/lib/index.js:57:19)
at async /Users/christian/.volta/tools/image/packages/@pnpm/make-dedicated-lockfile/lib/node_modules/@pnpm/make-dedicated-lockfile/node_modules/@pnpm/exportable-manifest/lib/index.js:44:9
at async Promise.all (index 35)
at async makePublishDependencies (/Users/christian/.volta/tools/image/packages/@pnpm/make-dedicated-lockfile/lib/node_modules/@pnpm/make-dedicated-lockfile/node_modules/@pnpm/exportable-manifest/lib/index.js:41:61)
at async makePublishManifest (/Users/christian/.volta/tools/image/packages/@pnpm/make-dedicated-lockfile/lib/node_modules/@pnpm/make-dedicated-lockfile/node_modules/@pnpm/exportable-manifest/lib/index.js:26:22)
at async default_1 (/Users/christian/.volta/tools/image/packages/@pnpm/make-dedicated-lockfile/lib/node_modules/@pnpm/make-dedicated-lockfile/lib/index.js:49:29)
at async main (/Users/christian/.volta/tools/image/packages/@pnpm/make-dedicated-lockfile/lib/node_modules/@pnpm/make-dedicated-lockfile/lib/bin.js:16:5) {
code: 'ERR_PNPM_CANNOT_RESOLVE_WORKSPACE_PROTOCOL',
hint: undefined,
attempts: undefined
}
And the resulting lockfile doesn't let me run pnpm fetch.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
We've got what I would've thought to be a pretty common pattern. A few different independent projects with some interlinking dependencies, and the top-level project only serves to manage the things that apply across repos (such as turborepo and pnpm).
My
pnpm-workspace.yamlfile is:I have added "@mono/quux" as a dependency of "@mono/foo" in the package.json:
This installs and runs fine for local development, but when I've got the following Dockerfile in apps/foo:
This fails because it can't find the package:
I've tried to look at using
pnpm fetchbut I don't think it's suitable here because apps/foo doesn't have a lockfile. When I try to run@pnpm/make-dedicated-lockfileI get another error:And the resulting lockfile doesn't let me run
pnpm fetch.We're at a bit of a loss for what to do.
All reactions