我正在处理一个Next.js项目,并使用TailWind CSS进行样式设置.然而,我在我的page.js
文件中遇到了一个与类名称相关的错误.我判断了导入语句,但错误仍然存在.谁能帮助我确定可能导致此问题的原因以及如何解决它?
Code snippet:个
import Link from "next/link";
const getSeries = async() => {
try {
const res = await fetch('http://localhost:3000/api', {cache: "no-store"});
if (!res.ok) {
throw new Error("Fetching failed");
};
return res.json();
} catch (error) {
console.error("Series Collection: c%FAILED","color:red",error);
}
}
export default async function Series() {
const {series} = await getSeries();
return (
<main>
{series?.map((serie) => {
return (
<div className="flex flex-col">
<div className="flex justify-between">
<div>
<div className="flex flex-col justify-start">
<h1 className="text-white font-extrabold pt-2 px-2 mt-2 mx-2">{serie.name}</h1>
<div className="flex justify-between pb-2 px-2 mt-2 mx-2">
<p className="text-orange-300 md:star_gradient font-extrabold">{serie.author}</p>
<p className="opacity-80 text-white font-extrabold ">{serie.rate}</p>
</div>
</div>
</div>
<Link href={`@/app/${serie}`} className="rounded opacity-80 bg-blue-500 text-center p-2 m-2 text-white font-extrabold shadow-sm">
See More
</Link>
</div>
<div className="flex carousel">
{serie.episodes?.map((episode) => {
<Link className={`bg-gradient-to-b from-[url("${episode.thumbnail}")] to-black flex align-end justify-end p-2 m-2 h-[300px] w-[640px] rounded shadow-md`} href={`@/app/${serie}/${episode.id}`}>
<h1>{episode?.name}</h1>
</Link>
})}
</div>
</div>
)})}
</main>
)
}
Error Message:个
./app/globals.css:4:0
Module not found: Can't resolve './{'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./app/globals.css
我怀疑这个问题可能与page.js
文件中的类名称有关,尽管我的导入语句似乎是正确的.任何有关调试和解决此问题的指导意见都将不胜感激.
Note: I need the image to be there since is a great part of my UI个