You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] The npx changeset version command does not work correctly if the prettier key is specified in package.json #1649
If the prettier key is present in package.json and it specifies a non-existent package, the npx changeset version command cannot create CHANGELOG.md files and fails with an error. The exit code is 0.
> npx changeset version && echo $?
Error: Cannot find module 'some-package'
Require stack:
- /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/index.js
- /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/write/dist/changesets-write.cjs.js
- /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/dist/changesets-cli.cjs.js
- /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/bin.js
at Function._resolveFilename (node:internal/modules/cjs/loader:1401:15)
at resolve (node:internal/modules/helpers:145:19)
at Object.transform (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/index.js:18425:34)
at run (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/third-party.js:8418:53)
at async cacheWrapper (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/third-party.js:8294:22)
at async Explorer.search (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/third-party.js:8407:24)
at async Promise.all (index 0)
at async writeFormattedMarkdownFile (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/apply-release-plan/dist/changesets-apply-release-plan.cjs.js:461:76)
at async updateChangelog (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/apply-release-plan/dist/changesets-apply-release-plan.cjs.js:435:7)
at async Object.applyReleasePlan [as default] (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/apply-release-plan/dist/changesets-apply-release-plan.cjs.js:351:7) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/index.js',
'/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/write/dist/changesets-write.cjs.js',
'/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/dist/changesets-cli.cjs.js',
'/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/bin.js'
]
}
🦋 All files have been updated. Review them and commit at your leisure
0
Expected behavior
Command npx changeset version fails with error, exit code 0
Current behavior
The command npx changeset version does not fail with an error, exit code 0
That's because changesets formats with prettier internally and the config is respected. If it's a string, it'll try to import it. Is there a reason you've set that value?
You can also disable prettier formatting with the prettier: false option in .changeset/config.json (looks like it hasn't been documented). And there's some movement to make formatting in general more flexible: #1639
Activity
bluwy commentedon Apr 26, 2025
That's because changesets formats with prettier internally and the config is respected. If it's a string, it'll try to import it. Is there a reason you've set that value?
You can also disable prettier formatting with the
prettier: falseoption in.changeset/config.json(looks like it hasn't been documented). And there's some movement to make formatting in general more flexible: #1639alSergey commentedon Apr 26, 2025
Okay, is it possible to crash with exit code 1 if formatting with prettier failed?
bluwy commentedon Apr 26, 2025
Yeah it should probably exit with 1
bluwy commentedon Jul 1, 2026
This should be fixed in #1994 with exit code 1 returned if formatting fails.