fresh icon indicating copy to clipboard operation
fresh copied to clipboard

Can't resolve 'tailwindcss' in mono-repo

Open theTechGoose opened this issue 3 months ago • 2 comments

this is the minimum reproducible repo https://github.com/theTechGoose/deno-playground

cd into /src/fresh-project/ run deno task dev wait for the server to come up navigate to the base url profit.

this is the error:

3:19:38 PM [vite] (client) Pre-transform error: Can't resolve 'tailwindcss' in '/Users/raphaelcastro/Documents/programming/deno-playground/src/ fresh-project/assets' Plugin: @tailwindcss/vite:generate:serve File: /Users/raphaelcastro/Documents/programming/deno-playground/src/fresh-project/assets/styles.css 3:19:38 PM [vite] (client) Pre-transform error: Can't resolve 'tailwindcss' in '/Users/raphaelcastro/Documents/programming/deno-playground/src/ fresh-project/assets' Plugin: @tailwindcss/vite:generate:serve File: /Users/raphaelcastro/Documents/programming/deno-playground/src/fresh-project/assets/styles.css (x2) 3:19:38 PM [vite] Internal server error: Can't resolve 'tailwindcss' in '/Users/raphaelcastro/Documents/programming/deno-playground/src/fresh-p roject/assets' Plugin: @tailwindcss/vite:generate:serve File: /Users/raphaelcastro/Documents/programming/deno-playground/src/fresh-project/assets/styles.css at finishWithoutResolve (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:565:18) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:657:14 at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:718:5 at eval (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/HookCodeFactory.js:31:1 0), :15:1) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:718:5 at eval (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/HookCodeFactory.js:31:1 0), :16:1) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:718:5 at eval (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/HookCodeFactory.js:31:1 0), :15:1) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:718:5 at eval (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/HookCodeFactory.js:31:1 0), :15:1) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:718:5 at eval (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/HookCodeFactory.js:31:1 0), :42:1) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/ConditionalPlugin.js:53:42 at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:718:5 at eval (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/HookCodeFactory.js:31:1 0), :16:1) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/forEachBail.js:39:13 at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/ModulesInHierarchicalDirectoriesPlugin.js: 83:16 at SyncAsyncFileSystemDecorator.stat (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/SyncAsy ncFileSystemDecorator.js:66:34) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/ModulesInHierarchicalDirectoriesPlugin.js: 57:11 at next (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/forEachBail.js:35:3) at forEachBail (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/forEachBail.js:49:9) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/ModulesInHierarchicalDirectoriesPlugin.js: 49:6 at _next0 (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/HookCodeFactory.js:31 :10), :8:1) at eval (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/HookCodeFactory.js:31:1 0), :30:1) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/SelfReferencePlugin.js:38:46 at Hook.eval [as callAsync] (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/Hoo kCodeFactory.js:31:10), :22:1) at Resolver.doResolve (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:715:16) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/ConditionalPlugin.js:42:14 at Hook.eval [as callAsync] (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/Hoo kCodeFactory.js:31:10), :37:1) at Resolver.doResolve (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:715:16) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/NextPlugin.js:30:14 at Hook.eval [as callAsync] (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/Hoo kCodeFactory.js:31:10), :7:1) at Resolver.doResolve (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:715:16) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/NextPlugin.js:30:14 at Hook.eval [as callAsync] (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/Hoo kCodeFactory.js:31:10), :7:1) at Resolver.doResolve (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Resolver.js:715:16) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/NextPlugin.js:30:14 at _next0 (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/HookCodeFactory.js:31 :10), :8:1) at eval (eval at create (file:///Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/tapable/2.2.3/lib/HookCodeFactory.js:31:1 0), :30:1) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/DescriptionFilePlugin.js:67:16 at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/DescriptionFileUtils.js:164:13 at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/forEachBail.js:39:13 at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/DescriptionFileUtils.js:113:16 at SyncAsyncFileSystemDecorator.readJson (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/Syn cAsyncFileSystemDecorator.js:199:14) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/DescriptionFileUtils.js:104:26 at next (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/forEachBail.js:35:3) at forEachBail (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/forEachBail.js:49:9) at findDescriptionFile (/Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/DescriptionFileUtils. js:70:3) at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/DescriptionFileUtils.js:167:12 at /Users/raphaelcastro/Library/Caches/deno/npm/registry.npmjs.org/enhanced-resolve/5.18.3/lib/forEachBail.js:39:13

theTechGoose avatar Sep 26 '25 19:09 theTechGoose

This might give a hint:

Warning "nodeModulesDir" field can only be specified in the workspace root deno.json file.
    at file:///deno-playground/src/fresh-project/deno.json

fry69 avatar Sep 26 '25 19:09 fry69

Your reproduction works fine for me when I move this property to the root deno.json file (also I recommend to use manual currently, as auto is a bit buggy):

  "nodeModulesDir": "manual"

Then you need to run

deno install --allow-scripts

and then

deno task dev

in the src/fresh-project folder works.

If you prefer a diff:

diff --git a/deno.json b/deno.json
index f61ae6b..c7ad6e1 100644
--- a/deno.json
+++ b/deno.json
@@ -11,5 +11,6 @@
     "vite": "npm:vite@^7.1.3",
     "tailwindcss": "npm:tailwindcss@^4.1.10",
     "@tailwindcss/vite": "npm:@tailwindcss/vite@^4.1.12"
-  }
+  },
+  "nodeModulesDir": "manual"
 }
diff --git a/src/fresh-project/deno.json b/src/fresh-project/deno.json
index 9089776..0da1aa2 100644
--- a/src/fresh-project/deno.json
+++ b/src/fresh-project/deno.json
@@ -1,5 +1,4 @@
 {
-  "nodeModulesDir": "auto",
   "tasks": {
     "check": "deno fmt --check . && deno lint . && deno check",
     "dev": "vite",

fry69 avatar Sep 26 '25 20:09 fry69