Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TheKnarf opened this issue Mar 21, 2024 · 3 comments
Open

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

TheKnarf opened this issue Mar 21, 2024 · 3 comments

Comments

@TheKnarf
Copy link

TheKnarf commented Mar 21, 2024

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
@legobeat
Copy link

legobeat commented Jun 4, 2024

@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"
}

@TheKnarf
Copy link
Author

TheKnarf commented Jun 5, 2024

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.

@legobeat
Copy link

legobeat commented Jun 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants