pvolok/mprocs

Doesn't work with Docker container `node:20-slim`

TheKnarf opened this issue · 3 comments

Doesn't work with Docker container node:20-slim.

Dockerfile:

FROM node:20-slim AS build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

WORKDIR /app
COPY . .

RUN pnpm install --frozen-lockfile

EXPOSE 3000
CMD [ "pnpm", "--filter", "app", "run", "dev" ]

Where the package.json is:

{
   "scripts": {
    "dev": "mprocs 'pnpm dev:start' 'pnpm dev:types'",
    "dev:start": "nodemon --watch 'src/**' --ext 'ts' --exec './src/index.ts'",
    "dev:types": "pnpm typecheck --watch",
   }
}

And with error message:

> mprocs 'pnpm dev:start' 'pnpm dev:types'

/app/node_modules/.pnpm/mprocs@0.6.4/node_modules/mprocs/cli.js:12
  throw new Error(
  ^

Error: Platform not supported by npm distribution. Check https://github.com/pvolok/mprocs for other ways to install procs on your platform.
    at Object.<anonymous> (/app/node_modules/.pnpm/mprocs@0.6.4/node_modules/mprocs/cli.js:12:9)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.11.1
/app/packages/bff-graphql-poc:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  bff-graphql-poc@ dev: `mprocs 'pnpm dev:start' 'pnpm dev:types'`
Exit status 1

@TheKnarf This works for me (after slight fixes it since I guess the samples are sliced from private code).

Am I right in guessing you're on arm64 infrastructure (e.g. a recent Apple Mac)? It looks like it's a matter of CPU architecture and you'll get the same result with any docker image on the same device.

Dockerfile

FROM node:20-slim AS build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

WORKDIR /app
COPY . .

RUN pnpm install

EXPOSE 3000

package.json

CMD [ "pnpm", "run", "dev" ]
{
  "name": "mprocs-docker",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "devDependencies": {
    "mprocs": "*"
  },
  "scripts": {
   "dev": "mprocs 'pnpm dev:start' 'pnpm dev:types'",
   "dev:start": "nodemon --watch 'src/**' --ext 'ts' --exec './src/index.ts'",
   "dev:types": "pnpm typecheck --watch"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

Am I right in guessing you're on arm64 infrastructure (e.g. a recent Apple Mac)?

Ah yes, I am running an MacBook Pro with an M3 processor.

I guess this issue can be reformulated as Published npm package only supports amd64 CPU architecture?
If I understand it right, this is only due to the prebuilt binaries used by the published package on npmjs.org. I think it should still work fine (with the same Docker base image) if you build the package yourself.

A pnpm pack should yield a file you can install in the build container directly with pnpm install filename.tgz.

The error message tells you as much:

Error: Platform not supported by npm distribution. Check https://github.com/pvolok/mprocs for other ways to install procs on your platform.