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

installing deno on alpine leads to deno: not found #311

Open
BlackScorp opened this issue Nov 9, 2024 · 3 comments
Open

installing deno on alpine leads to deno: not found #311

BlackScorp opened this issue Nov 9, 2024 · 3 comments

Comments

@BlackScorp
Copy link

Hi all, i want to create a frontend service in a custom docker container but after installing deno, it is not found on cmd but the binary is there. maybe the binary is not compatible with alpine linux?

I use following Docker file

ARG ALPINE_VERSION=${ALPINE_VERSION:-latest}
FROM alpine:$ALPINE_VERSION


RUN apk -U upgrade
RUN apk add --no-cache \
    curl

RUN export DENO_INSTALL=/usr/local && curl -fsSL https://deno.land/install.sh |  sh

CMD ["tail","-f","/dev/null"]

the output of the installation is following

######################################################################## 100.0%
Archive:  /usr/local/bin/deno.zip
  inflating: deno
Deno was installed successfully to /usr/local/bin/deno
sh: /usr/local/bin/deno: not found
Run 'deno --help' to get started

Stuck? Join our Discord https://discord.gg/deno

you can already see here the not found error.

so i checked /usr/local/bin

total 138384
drwxr-xr-x    1 root     root          4096 Nov  9 21:22 .
drwxr-xr-x    1 root     root          4096 Sep  6 11:34 ..
-rwxr-xr-x    1 root     root     141686664 Nov  9 21:22 deno

the file is there and is executable

echo $PATH shows following

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

so executable is there but is for some reason it is not found. i cannot use alpines apk add deno because it is in version 1.4 and i would like to use the latest one.

maybe someone has an idea?

@jabez007
Copy link
Contributor

I'm running into the same issue, and I think it's something to do with this section of the install.sh basically skipping run_shell_setup which is where the PATH is updated with the location of deno

# If stdout is a terminal, see if we can run shell setup script (which includes interactive prompts)
if [ -z "$CI" ] && [ -t 1 ] && $exe eval 'const [major, minor] = Deno.version.deno.split("."); if (major < 2 && minor < 42) Deno.exit(1)'; then
	if [ -t 0 ]; then
		run_shell_setup "$@"
	else
		# This script is probably running piped into sh, so we don't have direct access to stdin.
		# Instead, explicitly connect /dev/tty to stdin
		run_shell_setup "$@" </dev/tty
	fi
fi

@jabez007
Copy link
Contributor

jabez007 commented Nov 21, 2024

this should be fixed now by passing -y to the install script

for example

FROM debian:stable-slim

RUN apt-get update && \
  apt-get install -y \
  bash \
  curl \
  unzip

ENV SHELL="/bin/bash"

RUN curl -fsSL https://deno.land/install.sh | DENO_INSTALL=/usr/local sh -s -- -y

CMD ["/bin/bash"]

@jabez007
Copy link
Contributor

jabez007 commented Nov 22, 2024

Actually, sorry that does not completely fix your issue. You're right, it seems like that alpine base image just doesn't have some dependencies that the deno binary needs.

ldd /usr/local/bin/deno returns

Error relocating /lib/ld-linux-x86-64.so.2: unsupported relocation type 37
Error relocating /usr/local/bin/deno: __isnan: symbol not found
Error relocating /usr/local/bin/deno: __memcpy_chk: symbol not found
Error relocating /usr/local/bin/deno: __vfprintf_chk: symbol not found
Error relocating /usr/local/bin/deno: __vsnprintf_chk: symbol not found
Error relocating /usr/local/bin/deno: __sysconf: symbol not found
Error relocating /usr/local/bin/deno: backtrace: symbol not found
Error relocating /usr/local/bin/deno: backtrace_symbols: symbol not found
Error relocating /usr/local/bin/deno: __mbrlen: symbol not found
Error relocating /usr/local/bin/deno: strtoll_l: symbol not found
Error relocating /usr/local/bin/deno: strtoull_l: symbol not found
Error relocating /usr/local/bin/deno: __register_atfork: symbol not found
Error relocating /usr/local/bin/deno: gnu_get_libc_version: symbol not found
Error relocating /usr/local/bin/deno: __res_init: symbol not found

Otherwise, there is an official Deno Alpine image denoland/deno:alpine
denoland/deno_docker#240 (comment)

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