{"record":{"id":"1c4d32e40c6f9592","repo":"nodejs/node","slug":"not-supported-target","errorCode":null,"errorMessage":"{} not supported (target {}).","messagePattern":"(.+?) not supported \\(target (.+?)\\)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/msvs_emulation.py","lineNumber":240,"sourceCode":"                getattr(self, field)[configname] = config.get(field, default())\n\n        self.msvs_cygwin_dirs = spec.get(\"msvs_cygwin_dirs\", [\".\"])\n\n        unsupported_fields = [\n            \"msvs_prebuild\",\n            \"msvs_postbuild\",\n        ]\n        unsupported = []\n        for field in unsupported_fields:\n            for config in configs.values():\n                if field in config:\n                    unsupported += [\n                        \"{} not supported (target {}).\".format(\n                            field, spec[\"target_name\"]\n                        )\n                    ]\n        if unsupported:\n            raise Exception(\"\\n\".join(unsupported))\n\n    def GetExtension(self):\n        \"\"\"Returns the extension for the target, with no leading dot.\n\n        Uses 'product_extension' if specified, otherwise uses MSVS defaults based on\n        the target type.\n        \"\"\"\n        ext = self.spec.get(\"product_extension\", None)\n        return ext or gyp.MSVSUtil.TARGET_TYPE_EXT.get(self.spec[\"type\"], \"\")\n\n    def GetVSMacroEnv(self, base_to_build=None, config=None):\n        \"\"\"Get a dict of variables mapping internal VS macro names to their gyp\n        equivalents.\"\"\"\n        target_arch = self.GetArch(config)\n        target_platform = \"Win32\" if target_arch == \"x86\" else target_arch\n        target_name = self.spec.get(\"product_prefix\", \"\") + self.spec.get(\n            \"product_name\", self.spec[\"target_name\"]\n        )","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/msvs_emulation.py#L222-L258","documentation":"msvs_emulation.MsvsSettings checks a set of MSVS-only fields (the 'unsupported_fields' list, which includes 'msvs_postbuild') against each configuration. When using a non-MSVS generator (typically ninja), these fields have no meaning, so each occurrence is reported as unsupported and the accumulated list is raised as a single Exception.","triggerScenarios":"A target spec contains one of the unsupported_fields keys (e.g. msvs_postbuild) inside one of its configurations, and the build uses the ninja (or other non-msvs) generator that routes through msvs_emulation.","commonSituations":"Copying MSVS-specific settings from a Visual Studio build into a target that is now built with ninja; leftover msvs_postbuild from a porting effort.","solutions":["Remove the offending MSVS-only field(s) from the configuration(s) of that target.","If you need the equivalent behavior under ninja, express it via generator-agnostic keys (e.g. postbuild steps via 'actions' or linker flags).","Re-run gyp with the ninja generator."],"exampleFix":"// before\n'configurations': {\n  'Release': { 'msvs_postbuild': 'echo done' }\n}\n// after\n'configurations': {\n  'Release': { }\n}\n// and, if needed, add a generator-agnostic action or linker flag","handlingStrategy":"validation","validationCode":"UNSUPPORTED = {'msvs_postbuild'}  # extend to match unsupported_fields\nfor cfg_name, cfg in target_dict.get('configurations', {}).items():\n    bad = UNSUPPORTED & set(cfg)\n    if bad and using_ninja:\n        raise ValueError(f'{target_dict[\"target_name\"]}: {bad} unsupported under ninja')","typeGuard":"def no_unsupported_msvs_fields(target_dict: dict, generator: str) -> bool:\n    if generator == 'ninja':\n        bad = {'msvs_postbuild'}\n        return all(not (bad & set(cfg)) for cfg in target_dict.get('configurations', {}).values())\n    return True","tryCatchPattern":null,"preventionTips":["Keep MSVS-only keys only in builds that use the msvs generator.","When porting to ninja, audit target dicts for msvs_* keys.","Use conditions keyed on the generator to gate msvs-specific fields."],"tags":["gyp","msvs","ninja","unsupported"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}