artpods56
artpods565d ago

Cant configure Tailwind with DaisyUI using Deno inside of Docker | Error: Cannot find module daisyui

I'm literally pulling my hair right now because i can't figure out why is it not working in my case. I got tailwind to work but i can't figure out why the DaisyUI can't be found. Im using docker for local development and here is my config related to deno. deno.json
{
"imports": {
"tailwindcss": "npm:tailwindcss@latest",
"daisyui": "npm:daisyui@latest",
"postcss": "npm:postcss@latest",
"autoprefixer": "npm:autoprefixer@latest"
},
"tasks": {
"build:css": "deno run -A npm:tailwindcss -i ./src/styles.css -o /static/styles.css --minify --watch"
},

"exclude": [
"dist/"
]

}

{
"imports": {
"tailwindcss": "npm:tailwindcss@latest",
"daisyui": "npm:daisyui@latest",
"postcss": "npm:postcss@latest",
"autoprefixer": "npm:autoprefixer@latest"
},
"tasks": {
"build:css": "deno run -A npm:tailwindcss -i ./src/styles.css -o /static/styles.css --minify --watch"
},

"exclude": [
"dist/"
]

}

tailwind.package.js
/** @type {import('tailwindcss').Config} */


module.exports = {
content: ["/templates/**/*.{html,js}"],
theme: {
extend: {},
},
plugins: [require("daisyui")],
}
/** @type {import('tailwindcss').Config} */


module.exports = {
content: ["/templates/**/*.{html,js}"],
theme: {
extend: {},
},
plugins: [require("daisyui")],
}
Error message from container logs
Attaching to django_demo, deno-1
deno-1 | Task build:css deno run -A npm:tailwindcss -i ./src/styles.css -o /static/styles.css --minify --watch
deno-1 |
deno-1 | Rebuilding...
deno-1 | Searching for config: 0.110ms
deno-1 | Module dependencies: 0.002ms
deno-1 | Error: Cannot find module 'daisyui'
deno-1 | Require stack:
deno-1 | - /deno/tailwind.config.js
deno-1 | at Function.Module._resolveFilename (node:module:619:15)
deno-1 | at Function.resolve (node:module:821:19)
deno-1 | at _resolve (file:///deno-dir/npm/registry.npmjs.org/jiti/1.21.6/dist/jiti.js:1:242050)
deno-1 | at loadConfig (file:///deno-dir/npm/registry.npmjs.org/tailwindcss/3.4.15/lib/lib/load-config.js:58:6) {
deno-1 | code: "MODULE_NOT_FOUND",
deno-1 | requireStack: [ "/deno/tailwind.config.js" ]
deno-1 | }
Attaching to django_demo, deno-1
deno-1 | Task build:css deno run -A npm:tailwindcss -i ./src/styles.css -o /static/styles.css --minify --watch
deno-1 |
deno-1 | Rebuilding...
deno-1 | Searching for config: 0.110ms
deno-1 | Module dependencies: 0.002ms
deno-1 | Error: Cannot find module 'daisyui'
deno-1 | Require stack:
deno-1 | - /deno/tailwind.config.js
deno-1 | at Function.Module._resolveFilename (node:module:619:15)
deno-1 | at Function.resolve (node:module:821:19)
deno-1 | at _resolve (file:///deno-dir/npm/registry.npmjs.org/jiti/1.21.6/dist/jiti.js:1:242050)
deno-1 | at loadConfig (file:///deno-dir/npm/registry.npmjs.org/tailwindcss/3.4.15/lib/lib/load-config.js:58:6) {
deno-1 | code: "MODULE_NOT_FOUND",
deno-1 | requireStack: [ "/deno/tailwind.config.js" ]
deno-1 | }
I would really appreciate any help as I'm pretty close to giving up..
3 Replies
2saturdayscode
I guess that tailwind tries to look into node_modules folder to resolve daisyui but it doesn't find it because deno does not use the node_modules dir Try add this to your deno.json config:
"nodeModulesDir": "auto",
"nodeModulesDir": "auto",
artpods56
artpods56OP3d ago
I feel like something like this should be mentioned somewhere in the documentation. It stated to work after this but the amount of time i spent on searching for solution.. Thank you!
2saturdayscode
You are most welcomed! The issue is that it's very hard to account for the very wide and often bizarre behavior of the node ecosystem and all the issues you will encounter with Deno will highlight what a mess it is!