conventional-changelog/conventional-changelog

TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING] When Importing JSON Modules

Closed this issue · 0 comments

Problem Description

When executing the tool from the terminal, I encounter the following error:

Failed to get file. TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///path/to/file/config.json" needs an import assertion of type "json"

This issue occurs when trying to run this command:

conventional-changelog -p conventionalcommits -c context.json -n config.json -i CHANGELOG.md -s -r 1 --skip-unstable

Environment

  • Node.js Version: v16.18.0
  • Operating System: Ubuntu 23.04

Additional Information

content of the config.json file

{
  "options":{
    "preset":{
      "name": "conventionalcommits",
      "commitUrlFormat": "{{host}}/{{owner}}/_git/{{repository}}/commit/{{hash}}",
      "compareUrlFormat": "{{host}}/{{owner}}/_git/{{repository}}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}&_a=files",
      "header": "Changelog",
      "types": [
        {"type": "feat", "section": "Features"},
        {"type": "fix", "section": "Bug Fixes"},
        {"type": "update", "section": "Changes or Updates", "hidden": false},
        {"type": "change", "section": "Changes or Updates", "hidden": false},
        {"type": "chore", "hidden": true},
        {"type": "docs", "hidden": true},
        {"type": "style", "hidden": true},
        {"type": "refactor", "hidden": true},
        {"type": "perf", "hidden": true},
        {"type": "test", "hidden": true},
        {"type": "ci", "hidden": true}
      ]  
    }  
  }  
}

Any help in resolving this issue would be greatly appreciated. Thanks in advance!