问题描述
最近,由于解析节点模块中的依赖项时出错,我在渲染 Next.js 应用程序时遇到了问题。这也阻止了我的 next.js 页面加载,我坚信这是由于“apollo-server-micro”依赖关系,因为当与它相关的任何导入被注释掉时,页面能够成功加载。
我已经尝试删除我的 node_modules 并重新安装它们,这与单独安装软件包一样不起作用。然而,尽管只是安装了包 "fs" ,我还是不断收到错误
error - ./node_modules/busboy/lib/main.js:1:0
Module not found: Can't resolve 'fs'
//import { gql,useMutation} from 'apollo-server-micro'; // when commented out the page loads otherwise it gives an error "Could not find files for login page in next/build-manifest.json"
import Router from "next/router";
import React,{ useEffect,useState } from 'react'
import AuthField from '../components/auth/authField'
export default function Login(props) {
const [disabled,setdisabled] = useState(false);
// const [user,setUser] = useContext(UserContext);
const [username,setUsername] = useState('');
const [password,setPassword] = useState("");
const handleSubmit = (e) => {
e.preventDefault();
console.log({username,password});
setdisabled(true);
}
return (
<div className="h-screen bg-light relative">
<div className=" bg-superlight rounded-sm w-4/12 absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 ">
<header className=" border-b border-solid border-light">
<div className="mx-auto w-10/12 py-4 flex items-center justify-between">
<p className="font-semibold text-2xl text-dark ">Login</p>
</div>
</header>
<form onSubmit={handleSubmit} className="shadow-md mx-auto w-full text-right">
<AuthField type='username' name="username" label="Username" value={username} onChange={(e) => setUsername(e.target.value)} />
<AuthField type='password' name="password" label="Password" value={password} onChange={(e) => setPassword(e.target.value)} />
<button type='submit' disabled={disabled} className=" px-8 py-4 bg-dark text-light font-bold">Login</button>
</form>
</div>
</div>
)
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)