Error: ENOENT: no such file or directory , stat 'C:/components.json' (shadcn-ui)
Unanswered
lushna posted this in #help-forum
lushnaOP
I am getting this error:
"Error: ENOENT: no such file or directory, stat 'C:/components.json' ./app/globals.css.webpack[javascript/auto]!=!./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[11].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[11].oneOf[12].use[3]!./app/globals.css
./app/globals.css"
when I am trying to run my next.js project.
The "components.json" file is the file that is generated by the shadcn-ui installation in order to use their components. It complains about the path here or the globals.css file in the app directory. My whole project is not in the "C:" folder its in "C:/Users/<username>/OneDrive/Desktop/<foldername>/project" .
Tried deleting the .next folder, node_modules and adding them back, nothing worked.
Same question is asked on stackoverflow also : https://stackoverflow.com/questions/78211594/error-in-next-js-shadcn-ui-on-running-npm-run-dev-error-enoent-no-such-file with the dependencies given too.
"Error: ENOENT: no such file or directory, stat 'C:/components.json' ./app/globals.css.webpack[javascript/auto]!=!./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[11].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[11].oneOf[12].use[3]!./app/globals.css
./app/globals.css"
when I am trying to run my next.js project.
The "components.json" file is the file that is generated by the shadcn-ui installation in order to use their components. It complains about the path here or the globals.css file in the app directory. My whole project is not in the "C:" folder its in "C:/Users/<username>/OneDrive/Desktop/<foldername>/project" .
Tried deleting the .next folder, node_modules and adding them back, nothing worked.
Same question is asked on stackoverflow also : https://stackoverflow.com/questions/78211594/error-in-next-js-shadcn-ui-on-running-npm-run-dev-error-enoent-no-such-file with the dependencies given too.
14 Replies
lushnaOP
One of the latest update of Shadcn-ui broke the cli. Its not generating the files and config correctly.
You're going to have to manually fix stuff up.
You're going to have to manually fix stuff up.
Try posting your
components.json and anything related to shadcn here.lushnaOP
components.json:
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "app/globals.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "app/globals.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
lushnaOP
could someone please help !
lushnaOP
@Clown hey could you please check my components.json, it would be great if you could help! still stuck at this error
Try re initializing using shadcn cli
Also post your tsconfig if you have that
lushnaOP
tsconfig.json-
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/": ["./"]
}
},
"include": ["next-env.d.ts", "/*.ts", "/.tsx", ".next/types/**/.ts"],
"exclude": ["node_modules"]
}
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/": ["./"]
}
},
"include": ["next-env.d.ts", "/*.ts", "/.tsx", ".next/types/**/.ts"],
"exclude": ["node_modules"]
}
@Clown Try re initializing using shadcn cli
lushnaOP
tried, didn't resolve
lushnaOP
here's the exact global.css I am trying to follow, https://github.com/adrianhajdin/event_platform/blob/main/app/globals.css
as per the error, something might be wrong with globals.css
as per the error, something might be wrong with globals.css
was trying to follow this guy's youtube tutorial in order to create a different use-case website, but the styles and the shadcn components he is using is same in mine too.
@Clown Try re initializing using shadcn cli
lushnaOP
I did this, but all the styles that i applied were gone. When i try to recopy the tailwind.config.ts and the globals.css of the styles i need after the re-initialization, the error pops up again. so i thought that the error might be in these files only.
so after re-initialization, the default setup works fine but as soon as i introduce styling everything goes wrong.
so after re-initialization, the default setup works fine but as soon as i introduce styling everything goes wrong.