Skip to content

Conversation

@ntvthuyen
Copy link

@ntvthuyen ntvthuyen commented Oct 25, 2025

So, recently I encounted this problem when tried to make change to my github page

error during build:
TypeError: localStorage.getItem is not a function
    at Object.<anonymous> (/home/runner/work/<my repo>/node_modules/.pnpm/@[email protected]/node_modules/@typescript/vfs/dist/vfs.cjs.production.min.js:1:386)
    at Module._compile (node:internal/modules/cjs/loader:1759:14)
    at Object..js (node:internal/modules/cjs/loader:1892:10)
    at Module.load (node:internal/modules/cjs/loader:1479:32)
    at Module._load (node:internal/modules/cjs/loader:1298:12)
    at TracingChannel.traceSync (node:diagnostics_channel:328:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:244:24)
    at Module.require (node:internal/modules/cjs/loader:1502:12)
    at require (node:internal/modules/helpers:152:16)
    at Object.<anonymous> (/home/runner/work/<my repo>/node_modules/.pnpm/@[email protected]/node_modules/@typescript/vfs/dist/index.js:5:20)
 ELIFECYCLE  Command failed with exit code 1.
ERROR: "kit:build" exited with 1.
 ELIFECYCLE  Command failed with exit code 1.

I put --no-webstorage to NODE_OPTIONS to prevent from using localStorage

Update 1:
This PR works only when you use github page, I'm still fixing the problem on Netlify

Error during build: TypeError: localStorage.getItem is not a function
@netlify
Copy link

netlify bot commented Oct 25, 2025

Deploy Preview for urara-demo failed. Why did it fail? →

Name Link
🔨 Latest commit 9c93d73
🔍 Latest deploy log https://app.netlify.com/projects/urara-demo/deploys/68fec87c87e0880008a5b371

@Interstellar750
Copy link
Collaborator

log at https://app.netlify.com/projects/urara-demo/deploys/68fccf6cda36680009d12b4c#L404
9:24:52 PM: > cross-env NODE_OPTIONS="--max_old_space_size=7680 --no-webstorage" vite build
9:24:52 PM: node: --no-webstorage is not allowed in NODE_OPTIONS
9:24:52 PM:  ELIFECYCLE  Command failed with exit code 9. (https://ntl.fyi/exit-code-9)

The --no-webstorage option is new and available only in Node.js v25: Command-line API | Node.js v25.0.0 Documentation

The current version used in the repository is ^20.11.17 (package.json#L42), which causes the build to fail.

Maybe the owner does not have enough time to update the project. You can try to update the node.js version yourself to try to fix this error 💪

@ntvthuyen
Copy link
Author

ntvthuyen commented Oct 27, 2025

Actually, we can modify the node version by changing .nvimrc file, however, i got an error when built the project on netlify after modified the node version:

Error: [vite-plugin-pwa:build] Could not load /opt/build/repo/src/static/favicon.png?
format=avif&quality=80&source&width=736 (imported by src/lib/components/prose/img.svelte): 
heifsave: Unsupported compression

I will keep working on this.

Note that, the change works flawlessly if you use github page instead of Netlify. I will revert the change to the first commit for people who want to use github page while Im working on the node version update. Quite mess up with the commits, I will close this PR and make another PR when I complete all the changes.

@ntvthuyen ntvthuyen marked this pull request as draft October 27, 2025 01:12
@ntvthuyen ntvthuyen marked this pull request as ready for review October 27, 2025 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants