"Looks like you're trying to use Typescript" When running nextjs with bun in docker
Answered
Jumbo flying squid posted this in #help-forum
Jumbo flying squidOP
Has anyone gotten this error when trying to run there nextjs13/bun app in docker?
I am not using typescript, don't have any typescript files or the mentioned tsconfig. The application has also been running fine locally. My docker file looks like this adapted from the dockerfile on the bun website:
I've tried adding typescript and @types/react in the bun install step to no luck. Anyone experienced this or have any ideas?
It looks like you're trying to use TypeScript but do not have the required package(s) installed.
Installing dependencies
If you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files in your pages directory).
Installing devDependencies (npm):
- typescript
- @types/react
Failed to install required TypeScript dependencies, please install them manually to continue:
npm install --save-exact --save-dev typescript @types/react
{
command: "npm install --save-exact --save-dev typescript @types/react"
}I am not using typescript, don't have any typescript files or the mentioned tsconfig. The application has also been running fine locally. My docker file looks like this adapted from the dockerfile on the bun website:
# Use the official Bun image as the base image
FROM node:16 AS base
WORKDIR /nextjsapp
RUN npm install -g bun
# Install development dependencies into a temp directory
# This will cache them and speed up future builds
FROM base AS dev-install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
# Copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM dev-install AS development
COPY --from=dev-install /temp/dev/node_modules node_modules
COPY . .
# Set the environment to development
#ENV NODE_ENV=development
EXPOSE 3000
# Run the app in development mode
ENTRYPOINT [ "bun", "--bun", "run", "dev" ]
#ENTRYPOINT [ "ls", "./node_modules" ]I've tried adding typescript and @types/react in the bun install step to no luck. Anyone experienced this or have any ideas?
Answered by riský
Yes it is a very known thing that bun doesn't work with nextjs right now
4 Replies
Jumbo flying squidOP
Seems like this is actually an error with bun as things work fine when switching to NPM
Yes it is a very known thing that bun doesn't work with nextjs right now
Answer
Also this is the latest update https://nextjs-forum.com/post/1155146640605315072#message-1157647830559752232
Jumbo flying squidOP
Thanks for the link