next-dev.js:89 TypeError: Cannot read property 'parentNode' of null

next-dev.js:89 TypeError: Cannot read property 'parentNode' of null

我在通过 npm run build 构建并使用 npm run start

启动它后收到此错误

知道为什么会显示此错误吗?

我的整个布局也是错误的,我猜是因为tailwindcss错误

这是我的_app.tsx

import type { AppProps } from 'next/app'
import "tailwindcss/tailwind.css"
import "../styles/styles.scss"
import { Provider, useSelector } from 'react-redux'
import { Application } from 'react-rainbow-components'
import { ThemeStore } from '../config/redux/ThemeStore'
import { theme } from '../config/react-rainbow/react-rainbow-config'
import { ThemeState } from '../config/redux/ThemeReducer'
import Navigation from '../components/navigation/Navigation'

const Child: React.FC = ({ children }) => {

  const isDark = useSelector<ThemeState, ThemeState["isDark"]>(state => state.isDark)

  return <div className={`${isDark ? "dark blackThemeColor test" : "white whiteThemeColor"}` + " min-h-screen font-body pr-0"} style={{ height: '150vh' }}>{children}</div>;
}
const MyApp = ({ Component, pageProps }: AppProps) => {

  return (
    <Provider store={ThemeStore}>
      <Application theme={theme}>
        <Child>
         <Navigation />
          <Component {...pageProps} />
        </Child>
      </Application>
    </Provider>
  );
};
export default MyApp

感谢所有帮助

@juliomalves 指出我在导入 tailwindcss/tailwind.css 时并不需要它。

这是因为在设置项目时我在 docs

中阅读了这篇文章

Import Tailwind directly in your JS If you aren't planning to write any custom CSS in your project, the fastest way to include Tailwind is to import it directly in pages/_app.js:

重新看了还有这个选项

Include Tailwind in your CSS Open the ./styles/globals.css file that Next.js generates for you by default and use the @tailwind directive to include Tailwind's base, components, and utilities styles, replacing the original file contents:

所以我删除了 tailwindcss 导入并在我的 scss 文件中导入 tailwind,如下所示:

@tailwind base;
@tailwind components;
@tailwind utilities;

现在 npm run buildnpm run start 布局正确并且错误消失了