Don’t switch on my account, I want to make this work.
It looks like you were running with 12.22.12
which doesn’t support the optional chaining operator: Node.js ES2015/ES6, ES2016 and ES2017 support
Making the following changes to your Dockerfile will enable you to deploy using Bun:
# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential curl ca-certificates node-gyp pkg-config python-is-python3
# Install Node.js
ARG NODE_VERSION=21.6.2
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
rm -rf /tmp/node-build-master
Note you need to add both curl
and ca-certificates
to the apt-get install
line, and add the lines to install Node.js. This is only for the build step to complete, none of these packages will be included in your final image.