Lunarequest
Lunarequest•11mo ago

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
Deno AI Helper
Deno AI Helper•11mo ago
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 help
Lunarequest
Lunarequest•11mo ago
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
:warning: x86_64 | Require stack:
:warning: x86_64 | - /home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/lib/setupTrackingContext.js
:warning: x86_64 | - /home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/plugin.js
:warning: x86_64 | - /home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/index.js
:warning: x86_64 | - /home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/index.js
:warning: x86_64 | at Function.Module._resolveFilename (node:module:624:15)
:warning: x86_64 | at Function.Module._load (node:module:502:27)
:warning: x86_64 | at Module.require (node:module:677:19)
:warning: x86_64 | at require (node:module:791:16)
:warning: x86_64 | at Object.<anonymous> (file:///home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:17:58)
:warning: x86_64 | at Object.<anonymous> (file:///home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:168:4)
:warning: x86_64 | at Module._compile (node:module:733:34)
:warning: x86_64 | at Object.Module._extensions..js (node:module:747:10)
:warning: x86_64 | at Module.load (node:module:658:32)
:warning: x86_64 | at Function.Module._load (node:module:539:12)
2023/09/14 11:24:22 ERROR: failed to build package. the build environment has been preserved:
:information_source: x86_64 | workspace dir: /tmp/melange-workspace-678298445
:information_source: x86_64 | guest dir: /tmp/melange-guest-866380308
2023/09/14 11:24:22 error during command execution: failed to build package: unable to run pipeline: exit status 1
:warning: x86_64 | Require stack:
:warning: x86_64 | - /home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/lib/setupTrackingContext.js
:warning: x86_64 | - /home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/plugin.js
:warning: x86_64 | - /home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/index.js
:warning: x86_64 | - /home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/index.js
:warning: x86_64 | at Function.Module._resolveFilename (node:module:624:15)
:warning: x86_64 | at Function.Module._load (node:module:502:27)
:warning: x86_64 | at Module.require (node:module:677:19)
:warning: x86_64 | at require (node:module:791:16)
:warning: x86_64 | at Object.<anonymous> (file:///home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:17:58)
:warning: x86_64 | at Object.<anonymous> (file:///home/build/static_src/node_modules/.deno/tailwindcss@3.3.3/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:168:4)
:warning: x86_64 | at Module._compile (node:module:733:34)
:warning: x86_64 | at Object.Module._extensions..js (node:module:747:10)
:warning: x86_64 | at Module.load (node:module:658:32)
:warning: x86_64 | at Function.Module._load (node:module:539:12)
2023/09/14 11:24:22 ERROR: failed to build package. the build environment has been preserved:
:information_source: x86_64 | workspace dir: /tmp/melange-workspace-678298445
:information_source: x86_64 | guest dir: /tmp/melange-guest-866380308
2023/09/14 11:24:22 error during command execution: failed to build package: unable to run pipeline: exit status 1
in the end I had to specifically delete the node_modules & deno.lock