Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 ENOENT error on node:18-alpine container #4632

Open
1 task done
ZendyLim opened this issue Jun 29, 2023 · 6 comments
Open
1 task done

🐛 ENOENT error on node:18-alpine container #4632

ZendyLim opened this issue Jun 29, 2023 · 6 comments
Labels
S-To triage Status: user report of a possible bug that needs to be triaged

Comments

@ZendyLim
Copy link

Environment information

/home/node/project-tsuki/server/node_modules/rome/bin/rome:37
                throw result.error;
                ^

Error: spawnSync /home/node/project-tsuki/server/node_modules/@rometools/cli-linux-x64/rome ENOENT
    at Object.spawnSync (node:internal/child_process:1110:20)
    at Object.spawnSync (node:child_process:871:24)
    at Object.<anonymous> (/home/node/project-tsuki/server/node_modules/rome/bin/rome:21:42)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawnSync /home/node/project-tsuki/server/node_modules/@rometools/cli-linux-x64/rome',
  path: '/home/node/project-tsuki/server/node_modules/@rometools/cli-linux-x64/rome',
  spawnargs: [ 'rage' ]
}

Node.js v18.16.1

What happened?

I have this docker and docker-compose configuration for VSCode devcontainer

FROM node:18-alpine

# Install git, openssh and zsh 
RUN apk add --no-cache curl git openssh zsh

# Set user to non-root
USER node

# Install Oh My ZSH and set ZSH as default shell
RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
ENV SHELL=/bin/zsh

# Set working directory
WORKDIR /home/node/project-tsuki/server
services:
  base:
    container_name: project-tsuki-server
    build:
      context: .
      dockerfile: ./Dockerfile
    volumes:
      - ..:/home/node/project-tsuki/server
    command: /bin/sh -c "while sleep 1000; do :; done"   
  1. Run npm i -D rome
  2. Run npx rome init

It exits with error below

/home/node/project-tsuki/server/node_modules/rome/bin/rome:37
                throw result.error;
                ^

Error: spawnSync /home/node/project-tsuki/server/node_modules/@rometools/cli-linux-x64/rome ENOENT
    at Object.spawnSync (node:internal/child_process:1110:20)
    at Object.spawnSync (node:child_process:871:24)
    at Object.<anonymous> (/home/node/project-tsuki/server/node_modules/rome/bin/rome:21:42)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawnSync /home/node/project-tsuki/server/node_modules/@rometools/cli-linux-x64/rome',
  path: '/home/node/project-tsuki/server/node_modules/@rometools/cli-linux-x64/rome',
  spawnargs: [ 'rage' ]
}

Expected result

Should be success and create a configuration file.

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@ZendyLim ZendyLim added the S-To triage Status: user report of a possible bug that needs to be triaged label Jun 29, 2023
@ematipico
Copy link
Contributor

Make sure that your container installs @rometools/cli-linux-x64 and it's inside node_modules. If not, it means that your package manager didn't install optionalDependencies. You will need to install it manually yourself.

@ZendyLim
Copy link
Author

I've looked into the node_modules and @rometools/cli-linux-x64/rome exists.

ls -lAh /home/node/project-tsuki/server/node_modules/@rometools/cli-linux-x64/rome
-rwxr-xr-x    1 node     node       13.5M Jun 29 15:27 /home/node/project-tsuki/server/node_modules/@rometools/cli-linux-x64/rome

@ematipico
Copy link
Contributor

To be honest, I'm not sure what the issue is. Probably some symbol link or something?

I never installed Rome this way.

@ZendyLim
Copy link
Author

ZendyLim commented Jun 30, 2023

So in attempt to work around this. I figured that alpine might missing some glibc stuff. So I installed it.

wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
 && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r1/glibc-2.35-r1.apk \
 && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r1/glibc-bin-2.35-r1.apk \
 && apk add glibc-2.35-r1.apk glibc-bin-2.35-r1.apk \
 && rm glibc-2.35-r1.apk glibc-bin-2.35-r1.apk

Now doesn't throw ENOENT error anymore.

npx rome init
Error relocating /home/node/project-tsuki/server/node_modules/@rometools/cli-linux-x64/rome: __register_atfork: symbol not found
Error relocating /home/node/project-tsuki/server/node_modules/@rometools/cli-linux-x64/rome: gnu_get_libc_version: symbol not found

Tried with Ubuntu and Debian version of node Docker Image and it works fine.

@will-path
Copy link

Also running into this on a node:18-alpine container. @rometools/cli-linux-arm64 is linked against /lib/ld-linux-aarch64.so.1 which isn't part of Alpine. I tried installing gcompat and then got this:

Rome encountered an unexpected error

This is a bug in Rome, not an error in your code, and we would appreciate it if you could report it to https://github.com/rome/tools/issues/ along with the following information to help us fixing the issue:

Source Location: library/alloc/src/raw_vec.rs:525:5
Thread Name: main
Message: capacity overflow

Also tried libc6-compat and it comes up with a different error:

Error relocating /opt/redacted/.yarn/unplugged/@rometools-cli-linux-arm64-npm-12.1.3-1a684f2047/node_modules/@rometools/cli-linux-arm64/rome: __register_atfork: symbol not found
Error relocating /opt/redacted/.yarn/unplugged/@rometools-cli-linux-arm64-npm-12.1.3-1a684f2047/node_modules/@rometools/cli-linux-arm64/rome: gnu_get_libc_version: symbol not found

Is it possible to build Rome for musl? For now I'll just run Rome outside of the container against my source code.

@SparksFlyx3
Copy link

I ran into the same problem with lts-alpine3.18.. We are trying to migrate our existing project from ESLint to rome.
Is there a solution yet?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S-To triage Status: user report of a possible bug that needs to be triaged
Projects
None yet
Development

No branches or pull requests

4 participants