question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

using latest packages vite-ssg build throws Invalid value used as weak map key

See original GitHub issue

when i run vite build, it completed successfully. but when i run npx vite-ssg build (building for server…)

(node:11183) UnhandledPromiseRejectionWarning: Error: [vite-ssg] Error on page: /
TypeError: Invalid value used as weak map key
    at WeakMap.set (<anonymous>)
    at normalizePropsOptions (project/node_modules/.pnpm/@vue+runtime-core@3.2.26/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:2166:15)
    at createComponentInstance (project/node_modules/.pnpm/@vue+runtime-core@3.2.26/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:5026:23)
    at renderComponentVNode (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:194:22)
    at ssrRenderComponent (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:620:12)
    at file://project/.vite-ssg-temp/main.mjs:1770:13
    at renderComponentSubTree (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:260:13)
    at renderComponentVNode (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:211:16)
    at renderVNode (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:301:22)
    at renderComponentSubTree (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:266:13)
    at project/node_modules/.pnpm/vite-ssg@0.17.5_97bac1ad760e801e4df55702908e73e1/node_modules/vite-ssg/dist/node/cli.cjs:223:13
    at async Promise.all (index 0)
    at async build (project/node_modules/.pnpm/vite-ssg@0.17.5_97bac1ad760e801e4df55702908e73e1/node_modules/vite-ssg/dist/node/cli.cjs:196:3)
    at async Object.handler (project/node_modules/.pnpm/vite-ssg@0.17.5_97bac1ad760e801e4df55702908e73e1/node_modules/vite-ssg/dist/node/cli.cjs:294:3)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11183) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
(node:11183) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

my package.json

{
  "private": true,
  "scripts": {
    "serve": "vite preview",
    "build": "cross-env NODE_ENV=production vite-ssg build",
    "lint": "eslint \"**/*.{vue,ts,js}\"",
    "dev": "vite",
    "preview": "vite preview",
    "preview-https": "serve dist",
    "test": "cypress open",
    "typecheck": "vue-tsc --noEmit"
  },
  "dependencies": {
    "@ant-design/icons-vue": "^6.0.1",
    "@mdi/font": "6.5.95",
    "@vueuse/core": "^7.5.3",
    "@vueuse/head": "^0.7.4",
    "ant-design-vue": "^3.0.0-beta.4",
    "axios": "^0.24.0",
    "dotenv-flow": "^3.2.0",
    "less": "^4.1.2",
    "material-design-icons": "^3.0.1",
    "moment": "^2.29.1",
    "nprogress": "^0.2.0",
    "pinia": "^2.0.9",
    "postcss": "^8.4.5",
    "prism-theme-vars": "^0.2.2",
    "realm-web": "^1.5.1",
    "roboto-fontface": "*",
    "sass": "^1.46.0",
    "unplugin-icons": "^0.13.0",
    "vite-plugin-style-import": "^1.4.1",
    "vue": "^3.2.26",
    "vue-demi": "^0.12.1",
    "vue-i18n": "^9.1.9",
    "vue-router": "^4.0.12",
    "vue-template-compiler": "^2.6.14",
    "vuelidate": "^0.7.7",
    "vuex": "^4.0.2",
    "vuex-persistedstate": "^4.1.0",
    "webfontloader": "^1.6.28"
  },
  "devDependencies": {
    "@antfu/eslint-config": "^0.15.0",
    "@babel/core": "^7.16.7",
    "@iconify-json/carbon": "^1.0.12",
    "@iconify-json/fa": "^1.0.1",
    "@iconify-json/ri": "^1.0.2",
    "@intlify/vite-plugin-vue-i18n": "^3.2.1",
    "@types/nprogress": "^0.2.0",
    "@vitejs/plugin-vue": "^2.0.1",
    "@vue/cli-plugin-babel": "5.0.0-beta.7",
    "@vue/cli-service": "5.0.0-beta.7",
    "@vue/compiler-sfc": "^3.2.26",
    "@vue/server-renderer": "^3.2.26",
    "critters": "^0.0.16",
    "cross-env": "^7.0.3",
    "eslint": "^8.6.0",
    "eslint-plugin-cypress": "^2.12.1",
    "https-localhost": "^4.7.0",
    "pnpm": "^6.25.0",
    "sass": "^1.46.0",
    "typescript": "^4.5.4",
    "unplugin-auto-import": "^0.5.5",
    "unplugin-vue-components": "^0.17.11",
    "vite": "^2.7.10",
    "vite-plugin-inspect": "^0.3.13",
    "vite-plugin-md": "^0.11.7",
    "vite-plugin-pages": "^0.19.9",
    "vite-plugin-pwa": "^0.11.12",
    "vite-plugin-vue-layouts": "^0.5.0",
    "vite-plugin-windicss": "^1.6.1",
    "vite-ssg": "^0.17.5",
    "vue-tsc": "^0.30.2"
  },
  "prettier": {
    "singleQuote": true,
    "semi": false
  }
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:19

github_iconTop GitHub Comments

2reactions
hannoerucommented, Jul 26, 2022

Normally every time I facing this problem is most related to a invalid DOM element in vue template, try to comment out code page by page then go smaller scale, finally you will find it.

1reaction
u007commented, Sep 6, 2022

@hannoeru that is sad case, same here

Read more comments on GitHub >

github_iconTop Results From Across the Web

nuxt request error Invalid value used as weak map key
I'm getting this error while trying to run : npm run dev Although this error , the app is working fine locally ,...
Read more >
"Invalid value used as weak map key" after update to r131
Hey guys, I just updated to r131.3. Im using typescript, so thats the latest type supported version right now.
Read more >
Vuepress2.x 编译报错TypeError: Invalid value used as weak ...
Vuepress2.x 编译报错TypeError: Invalid value used as weak map key. AvatarGiser 于 2021-08-06 11:18:22 发布 4255 收藏 3. 分类专栏: Vuepress2.x 文章标签: ...
Read more >
The "unable to retrieve the property" error appears if a value is ...
... in the subject. I see that the function that throw the error is !*** . ... var componentNames = new WeakMap, nextAnonymousComponent...
Read more >
[vue3] vuepress2 在打包的时候出现TypeError: Invalid value ...
TypeError : Invalid value used as weak map key at WeakMap.set ... 4 | <p>命令软件包下载地址:https://packages.debian.org/sid/pstack</p> 5 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found