next.js 未找到模块:无法解析"graphql"?

lhcgjxsq  于 2023-01-13  发布在  其他
关注(0)|答案(1)|浏览(138)

我的Next.js应用程序昨天运行良好,但今天它有这样的错误:

error - ./node_modules/@urql/core/dist/ddbb86ae.mjs:1:0
Module not found: Can't resolve 'graphql'

Import trace for requested module:
./node_modules/@urql/core/dist/urql-core.mjs
./node_modules/urql/dist/urql.es.js
./pages/_app.js

https://nextjs.org/docs/messages/module-not-found

我不知道发生了什么事,所以我git reset --hard,但问题仍然存在。请帮助我解决它。我很感激。
_应用程序.js:

import { StateContext } from "../lib/context";
import { Provider, createClient } from "urql";

const client = createClient({ url: "http://localhost:1337/graphql" });

function MyApp({ Component, pageProps }) {
  return (
    <StateContext>
      <Provider value={client}>
        <Nav />
        <Component {...pageProps} />
      </Provider>
    </StateContext>
  );
}

export default MyApp;
bvjxkvbb

bvjxkvbb1#

希望这能解决你的问题

npm install --save graphql ra-data-graphql

yarn add graphql ra-data-graphql

相关问题