deno behaving differently in local dev env and production docker builds
I'm currently trying to switch from using node+yarn 2 for my blogs static files to deno. however the tasks that work locally for me fail to run properly in my container buildenv. I've even tried to use the curl | sh installer but the same behaviour persists. npm packages have trouble resolving deps which does not happen in my local dev env. Am i missing something?
3 Replies
It sounds like you're experiencing some differences between your local development environment and your Docker build environment. This could be due to a variety of factors. Here are a few things you might want to check based on the documentation:
1. Deno version: Ensure that the Deno version you're using in your Docker build environment is the same as your local development environment. Differences in Deno versions could lead to different behaviors.
2. Dockerfile configuration: Check your Dockerfile to ensure it's correctly set up for Deno. The documentation provides an example Dockerfile for a Deno project. Make sure you're setting the
WORKDIR
, copying your project files into the Docker image, and caching your dependencies with deno cache
.
3. Permissions: Deno is secure by default and requires explicit permissions for certain operations. If your tasks are failing, it could be due to missing permissions in your Docker environment. Make sure you're providing the necessary permissions with flags like --allow-read
, --allow-net
, etc.
4. npm dependencies: If you're using npm packages in your Deno project, there could be compatibility issues. Deno has experimental support for npm specifiers, but it's still under development and you might encounter scenarios where something doesn't work. If you're using npm packages, make sure to run your Deno command with the --unstable
and --A
flags.
5. Lock file: Deno uses a lock file to ensure the integrity of dependencies. If you're using a lock file, make sure it's correctly set up and included in your Docker image.
If you've checked all of these and are still experiencing issues, it might be helpful to provide more specific error messages or details about the tasks that are failing. This could helpidentify if there's a specific issue with your setup. 🦕
see the issue isn't with npm deps directly but rather with deps of npm deps. for example I use tailwindcss as a postcss plugin, but it can't find
@alloc/quick-lru
and so on, I'm a bit confused to as why it works with some deps eg chalk works just fine but not others
the full error output is here. I'm using a tool called melange to build my container. hence the :warning: x86_64 |
bits
in the end I had to specifically delete the node_modules & deno.lock