VS Code - node js issue globals.css not detects in layout.tsx #183520
Replies: 5 comments
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
It seems like there is an issue with how the path to your Steps to resolve:
|
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
This error usually happens because Tailwind/PostCSS cannot resolve the CSS file path, not because of the CSS content itself. From the error message: the key issue is the absolute path starting with In a Next.js / Vite / modern frontend setup, CSS imports should normally use relative paths, not absolute filesystem paths. What is likely happeningYour file structure probably looks something like this: But somewhere you are importing it like this: @import '/app/assets/styles/globals.css';or in JS/TS: import '/app/assets/styles/globals.css'This makes the bundler search from the project root, which fails. FixUse a relative path instead. If your file is inside import './assets/styles/globals.css'or import '../assets/styles/globals.css'depending on the location. Also check your
|
Beta Was this translation helpful? Give feedback.
-
|
This is a common Next.js/Tailwind CSS import issue. Quick fix: Solution 1: Import in _app.tsx or layout.tsx // In your layout.tsx or _app.tsx
import './globals.css';Solution 2: Check next.config.js module.exports = {
webpack: (config) => {
config.module.rules.push({
test: /\.css$/,
use: ['style-loader', 'css-loader'],
});
return config;
},
};Solution 3: Check Tailwind Configuration
Solution 4: Troubleshooting
Root Cause: Your localhost build works because the CSS loads correctly at runtime, even if VSCode shows error. Quick Win: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I am trying to build sample e-commerce website. I am using VS Code Version: 1.107.1
ElectronBuildId: 12895514 Chromium: 142.0.7444.175 Node.js: 22.21.1 V8: 14.2.231.21-electron.0 OS: Darwin arm64 25.1.0 but when I use default globals.css it works fine as localhost:port response is good however When i try to custom one globals.css it wont detect at all instead throws error as below - I have tailwindCSS postCSS included in VC Code.
Error evaluating Node.js code
CssSyntaxError: tailwindcss: /Users/01/shopstore/src/app/assets/styles/globals.css:1:1: Can't resolve '/app/assets/styles/globals.css' in '/Users/01/shopstore/src/app/assets/styles'
[at Input.error (turbopack:///[project]/shopstore/node_modules/postcss/lib/input.js:135:16)]
[at Root.error (turbopack:///[project]/shopstore/node_modules/postcss/lib/node.js:146:32)]
Beta Was this translation helpful? Give feedback.
All reactions