Slice Machine: react-modal No elements found for #__next
Slice Machine won't open at localhost:9999 and logs "react-modal: No elements were found for selector #__next". What it means, what to check, and who to ask.
The Liite team7분 분량
Short answer
This error means the Slice Machine interface at localhost:9999 never rendered its root element, so react-modal found nothing to attach to. We found no confirmed fix, so work through the checks below in order: read the terminal, free port 9999, match your Node.js version, update the packages, reinstall cleanly, and rule out your browser and any proxy. If a fresh clone of the official starter fails too, send Prismic support the details listed below.
Slice Machine won't open at localhost:9999, and the browser console shows this:
react-modal: No elements were found for selector #__next
One person on Stack Overflow reported the same error with the unmodified official Next.js starter in 2025, along with a second error: SyntaxError: Unexpected token 'L', "Loading{"p"... is not valid JSON. As of November 2026, that question had no visible answer, and we found no confirmed fix for this pair. Everything below is a set of checks that fit the symptoms. Treat them as things to try, not a guaranteed cure.
Why it happens
The first message comes from react-modal, a library for dialogs. When a modal opens, the library is told which element to hide from screen readers. Here that selector is #__next, the root element Next.js apps normally render into. The error means the library looked for that element and the page didn't contain it.
That tells you the interface didn't render the way the code expected. It doesn't tell you why. The second message is the better hint. JSON.parse failed on text that starts with "Loading", which suggests something returned plain text or HTML where JSON was expected. That is our reading of the message, not a diagnosis from Prismic.
None of the causes below is confirmed for this report. They are the ones that would fit the symptoms, most likely first.
| Possible cause | What you would see | What to try |
|---|---|---|
| Mismatched Slice Machine packages | Works in one project, breaks in another | Update packages together |
| Unsupported Node.js version | Errors in the terminal at startup | Switch to a current LTS release |
| Broken install or stale cache | Odd failures after upgrades | Clean reinstall |
| Another process on port 9999 | Wrong or partial response in the browser | Stop all instances, start once |
| Proxy, VPN or extension | Response altered, JSON parse error | Test in a private window, proxy off |
Step-by-step fixes
Retest at localhost:9999 after each step.
1. Read the terminal first
Slice Machine runs as its own process, separate from your Next.js site. A stack trace or a "port in use" line in the terminal where you started it is more useful than the browser error. Copy it before you change anything, because you will need it if you contact support.
2. Check what is listening on port 9999
If an old Slice Machine process or another tool holds the port, you may be seeing its response rather than the current one.
- Close every terminal running Slice Machine.
- Check whether anything still answers on port 9999 using your operating system's tools for listing listening ports.
- Stop whatever is there, then start Slice Machine once.
3. Check your Node.js version
Compare your version with what the starter's README or package.json asks for. If you run a very new or very old release, switch to a current LTS version with your version manager, then reinstall and restart.
Tip
Run node -v in the same terminal you use to start Slice Machine. Version managers often give different versions in different terminal windows.
4. Update the Slice Machine packages
Update them to the latest releases using the package manager the project already uses (npm, Yarn or pnpm), so the lockfile stays consistent. Then restart Slice Machine.
5. Do a clean reinstall
- Delete the
node_modulesfolder and the.nextfolder. - Install dependencies again with your package manager.
- Start Slice Machine again.
Delete the lockfile as well only if that first clean install didn't help. Removing it lets dependencies move to newer versions, which can change more than you intended.
6. Rule out your browser
Open localhost:9999 in a private window with extensions off, or in another browser. Ad blockers and privacy extensions can interfere with local tools. If it loads, re-enable extensions one at a time to find the culprit.
7. Rule out a proxy or VPN
Turn them off briefly and reload. A rewritten response would produce a "not valid JSON" error, so this is worth a minute even if it seems unlikely.
8. Try the starter in a clean folder
Clone the official starter again into a new directory, install, and run Slice Machine without changing anything. If that works, compare it with your project to find the difference. If it fails the same way, the cause is probably your environment or the tooling, and support is the next stop.
What won't help
- Adding a
#__nextelement by hand. It might silence the react-modal message, but the interface still didn't load properly. You would only be hiding the symptom. - Editing files inside
node_modules. The change disappears on the next install. - Restarting your Next.js site on its own port. Slice Machine is a separate process, so restarting the site doesn't affect it.
Checklist before you try again
- Only one Slice Machine process is running, and nothing else uses port 9999.
- Node.js matches what the starter asks for.
- Slice Machine packages are on matching, current versions.
node_modulesand.nextwere deleted and reinstalled.- The page loads the same way in a private window with extensions off.
- You saved the terminal output and the browser console output.
Check whether it is already fixed
Tool bugs like this are often patched in a later release, so before spending an hour on it:
- Look for incidents on Prismic's status page.
- Search Prismic's community forum and the Slice Machine GitHub issues for the exact error string.
- Read the release notes for your installed version and the one after it.
Note
Reports of this error are thin: we know of one public question, and it had no visible answer. Absence of a fix in public doesn't mean there is none, so ask Prismic directly.
If nothing works
Open a support request with Prismic through their official support channel. Include:
- your Node.js version and package manager;
- the Slice Machine package versions from
package.json; - the full terminal output from startup;
- the browser console output, with both error lines;
- whether a fresh clone of the official starter fails the same way;
- the steps above that you already tried.
A message you can adapt:
Subject: Slice Machine won't load at localhost:9999 (react-modal #__next error)
Hello,
Slice Machine does not open at localhost:9999. The browser console shows:
react-modal: No elements were found for selector #__next
SyntaxError: Unexpected token 'L', "Loading{"p"... is not valid JSON
Node.js version: <version>
Package manager: <npm / yarn / pnpm and version>
Slice Machine package versions: <from package.json>
OS: <your system>
Already tried: stopped other processes on port 9999, clean reinstall
(node_modules and .next deleted), private window without extensions,
fresh clone of the official Next.js starter.
Terminal output is attached. Can you tell me what is returning
non-JSON text to the interface, or which version fixes this?
ThanksCommon questions
Is the react-modal message the real error?
Probably not on its own. It is a symptom of the page lacking the root element it expected. The terminal output and the JSON parse error are better clues.
Does it matter that it happens with the official starter?
It suggests the cause may be in the tooling or your environment rather than your own code. That is why a fresh clone in a clean folder (step 8) is worth trying early if your project has many changes.
Is the "Unexpected token 'L'" error related?
It was reported together with the react-modal message, and the text starting with "Loading" suggests a non-JSON response reached code expecting JSON. Whether one causes the other isn't confirmed.
Should I switch tools?
Only if you've lost real time to this and Prismic support can't help. Try the checks above and a support request first.