TypeError: Cannot assign to read only property 'params' of object '#<Object>' #84512
-
SummaryI have no idea why this error comes in my project. After deleting the build directory and re-running Additional informationOperating System:
Platform: win32
Arch: x64
Version: Windows 11 Pro
Available memory (MB): 32561
Available CPU cores: 32
Binaries:
Node: 22.17.0
npm: 10.9.2
Yarn: N/A
pnpm: 10.13.1
Relevant Packages:
next: 15.5.4 // Latest available version is detected (15.5.4).
eslint-config-next: 15.3.4
react: 19.1.0
react-dom: 19.1.0
typescript: 5.8.3
Next.js Config:
output: export Examplehttps://github.com/opanel-mc/opanel/tree/main/frontend This issue may have something to do with this file: https://github.com/opanel-mc/opanel/blob/f1be02ab930454dad91a5415cda25d8763f83662/frontend/lib/settings.ts |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Let's try to discard a Turbopack issue, I don't think it is the issue but, worth trying. I'll take a look at your repository, unfortunately it is quite large, but let's see. |
Beta Was this translation helpful? Give feedback.
-
Solved. Final solution: function getLocalStorage() {
if(typeof window !== "undefined" && window.localStorage) {
return window.localStorage;
}
throw new Error("localStorage is not defined.");
} In the functions that need to use localStorage, do: let storage: Storage;
try {
storage = getLocalStorage();
} catch {
return ...;
}
// ... |
Beta Was this translation helpful? Give feedback.
Solved.
Final solution:
Use the following code instead of
const storage = window.localStorage;
at the top levelIn the functions that need to use localStorage, do: