Title: vm: `Object.defineProperty` doesn't work properly for `globalThis` · Issue #64008 · nodejs/node · GitHub
Open Graph Title: vm: `Object.defineProperty` doesn't work properly for `globalThis` · Issue #64008 · nodejs/node
X Title: vm: `Object.defineProperty` doesn't work properly for `globalThis` · Issue #64008 · nodejs/node
Description: Version 26.3.0 Platform Darwin hostname 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:38:00 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T8103 arm64 Subsystem No response What steps will reproduce the bug? Run a script below impor...
Open Graph Description: Version 26.3.0 Platform Darwin hostname 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:38:00 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T8103 arm64 Subsystem No response What steps will rep...
X Description: Version 26.3.0 Platform Darwin hostname 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:38:00 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T8103 arm64 Subsystem No response What steps will rep...
Opengraph URL: https://github.com/nodejs/node/issues/64008
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"vm: `Object.defineProperty` doesn't work properly for `globalThis`","articleBody":"### Version\n\n26.3.0\n\n### Platform\n\n```text\nDarwin hostname 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:38:00 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T8103 arm64\n```\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\nRun a script below\n\n```javascript\nimport { createContext, Script } from \"node:vm\";\n\nconst context = {};\ncreateContext(context);\nnew Script(\n `globalThis.foo = 0; Object.defineProperty(globalThis, \"foo\", { enumerable: false });`,\n).runInContext(context);\n\nconsole.log(context.foo);\n```\n\n### How often does it reproduce? Is there a required condition?\n\nalways\n\n### What is the expected behavior? Why is that the expected behavior?\n\nthe script should print \"0\", because `Object.defineProperty` without `value` option should keep the original value:\n\n```javascript\nglobalThis.foo = 0;\nObject.defineProperty(globalThis, \"foo\", { enumerable: false });\nconsole.log(globalThis.foo); // 0\n```\n\n### What do you see instead?\n\nthe script prints \"undefined\"\n\n### Additional information\n\nThe script works as intended in v26.2.0.","author":{"url":"https://github.com/fabon-f","@type":"Person","name":"fabon-f"},"datePublished":"2026-06-19T17:08:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/64008/node/issues/64008"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4cfa7074-f991-97e6-127f-6aca3186f99d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BB32:C2F0E:26C216D:380E666:6A4D1D93 |
| html-safe-nonce | e533123be434ffd5c38603f2dbef222596dd4614abfde4b3af43b9156c572a94 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQjMyOkMyRjBFOjI2QzIxNkQ6MzgwRTY2Njo2QTREMUQ5MyIsInZpc2l0b3JfaWQiOiIyMTQxMTQwNTE5OTU4MTU4NzM5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b45ad7b61bddf0878f4ac1225d26b5fe77b5163e31c52e516612838f7c46a0e7 |
| hovercard-subject-tag | issue:4702406530 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/64008/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5d794cccae9edce146c482a8fe8eab3b593f6b89ed426e258e3250bc839e037d/nodejs/node/issues/64008 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5d794cccae9edce146c482a8fe8eab3b593f6b89ed426e258e3250bc839e037d/nodejs/node/issues/64008 |
| og:image:alt | Version 26.3.0 Platform Darwin hostname 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:38:00 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T8103 arm64 Subsystem No response What steps will rep... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fabon-f |
| hostname | github.com |
| expected-hostname | github.com |
| None | bcb4661e6fb4fe8b394c51ea02ccdb2236d40dc59afc75a3bbba50bf6517134c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fb70bd3c4b2bec429781b65419e912c66e2d5581 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width