4

I'm getting an error as such:

Unhandled Runtime Error
TypeError: Cannot read properties of null (reading 'removeChild')

Call Stack
HTMLLinkElement.eval
node_modules/next/dist/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js (1:1136)

This happens when I edit a SASS file, but the app gets hot-reloaded correctly and everything works fine. It's just the error is kinda bugging me. What could this possibly be?

Note that I'm currently using NextJS 13.

My full code here

layout.js

import "./globals.scss";
import { dmSans } from "./fonts";

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        <div className={`${dmSans.variable}`}>{children}</div>
      </body>
    </html>
  );
}

page.js

"use client";

import { useEffect } from "react";
import ShortDescription from "@/components/short-description";
import SelectedWork from "@/components/selected-work";
import RotatingText from "@/components/rotating-text";

import pguImage from "@/public/pgu.webp";
import adaroImage from "@/public/adaro.webp";
import petraImage from "@/public/petra.webp";

import styles from "./page.module.scss";

import { gsap } from "gsap";

export default function Home() {
  useEffect(() => {
    gsap.to("#hero > * > *", {
      duration: 1,
      y: 0,
      opacity: 1,
      stagger: 0.25,
      ease: "power2",
    });
  }, []);

  return (
    <div id="main-container">
      <header className={styles.header}>
        <span className={styles.header__title}>OWENN GIMLI</span>
      </header>

      <div className={`${styles.hero} container`} id="hero">
        <div>
          <h4>\\ Personal portfolio</h4>
        </div>
        <div>
          <h1>DATA SCIENCE,</h1>
        </div>
        <div>
          <h1>WEB DEVELOPMENT</h1>
        </div>
        <div>
          <h1>&amp; DESIGN.</h1>
        </div>
      </div>
    </div>
  );
}
5
  • Can you edit your question to include the code for each file on the page this is happening? Commented Aug 15, 2023 at 8:59
  • I think the problem isn't connected to sass file but rather to piece of code with "removeChild" Commented Aug 15, 2023 at 11:00
  • When you save your sass file the page gets reloaded and due to the problem with that place of code the error is shown Commented Aug 15, 2023 at 11:01
  • @Lilly I literally have no removeChild used anywhere on my code. Commented Aug 18, 2023 at 8:33
  • @AudunHilden @Lilly I have edited my question and added the code. It seems to only happen when I save a module SASS file. Commented Aug 18, 2023 at 8:38

4 Answers 4

2

I faced the same error today trying to use SASS files. The way I resolved the problem was by removing the .next folder and restarting the server.

Sign up to request clarification or add additional context in comments.

Comments

1

I don't have a solution I'm afraid, but am also experiencing this problem.. I've found this on my search: https://github.com/webpack-contrib/mini-css-extract-plugin/issues/682 which claims that a similar issue has been fixed.

My code also runs and uploads fine, and does not use removeChild anywhere!

Sorry I don't have a fix, I'll let you know if I do figure it out, but I just wanted to let you know you're not alone :)

Screenshot of error

Comments

0

In my case it was a empty template.js file, error resolved after removing that

Comments

-3

At the risk of sounding like the guy in the picture below... I got the same error in development over and over again, but it seems to have disappeared when I killed my npm run dev process and restarted it. Sometimes it's just that simple, hope this will solve it for you as well!

IT Department

1 Comment

Nope doesn't work haha, I tried restarting the server, but still everytime I save a SASS file, it will still throw me the same error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.