ERROR prettier.resolveConfig.sync is not a function
Since the last update 0.39.0 I am getting the following error when trying to format a file:

Prettier debug output:
Atom version: 1.20.0
prettier-atom version: 0.39.0
prettier version: 1.7.0
prettier-eslint version: 8.1.0
prettier-atom configuration: {
"formatOnSaveOptions": {
"enabled": true,
"excludedGlobs": [
"**/*.html"
],
"respectEslintignore": true,
"showInStatusBar": false,
"javascriptScopes": [
"source.js",
"source.jsx",
"source.js.jsx",
"source.babel",
"source.js-semantic",
"text.html.basic",
"text.html.vue"
],
"typescriptScopes": [
"source.ts",
"source.tsx",
"source.ts.tsx"
],
"cssScopes": [
"source.css",
"source.less",
"source.css.less",
"source.scss",
"source.css.scss"
],
"jsonScopes": [
"source.json"
],
"graphQlScopes": [
"source.graphql"
],
"whitelistedGlobs": [],
"isDisabledIfNotInPackageJson": false,
"isDisabledIfNoConfigFile": false
},
"prettierOptions": {
"parser": "flow",
"semi": false,
"singleQuote": false,
"bracketSpacing": true,
"useTabs": false,
"jsxBracketSameLine": false,
"printWidth": 80,
"tabWidth": "auto",
"trailingComma": "none"
},
"useEslint": true,
"useEditorConfig": true,
"prettierEslintOptions": {
"prettierLast": false
}
}
Will make a hotfix for this if you have an old version of Prettier, but you can also upgrade Prettier to 1.7 and it should work.
Yes upgrading to 1.7 fixed the issue, thanks :)
@robwise How do you upgrade prettier inside the atom package?
I was getting
cannot read property 'sync' of undefined
upgrading prettier in the project's devDependencies to 1.7.0 solved it.
@robwise How do you upgrade prettier inside the atom package?
The prettier inside of the atom package is already updated. If you are seeing this error, it means you have a local version of prettier (or prettier-eslint or prettier-eslint-cli).
Guys, it seems that this is coming out of prettier-eslint still. I can try and make a PR over at prettier-eslint to gracefully fallback, but is anyone still experiencing this issue or is unable to upgrade prettier?
Greetings everyone. I have the same issue even after having updated both prettier and prettier-eslint to versions 1.7.0 and 8.1.0 respectively. Any other ideas?
Restart atom? 1.7.0 has resolve.config.sync so you should be good to go unless it's picking up an old version somehow
I did restart atom . Same problem..almost actually, now I'm getting cannot read property 'sync' of undefined. Where's that resolve.config.sync you're referring to? Thanks
@anal0gK1d It's still picking up an old version of Prettier.
What do you get when you run npx prettier -v from your project directory?
@darahak you're right! npx prettier -v gives me the following:
"npx: installed 1 in 3.144s 'prefix' is not recognized as an internal or external command,operable program or batch file. 1.3.1"
whereas prettier -v gives me:
1.7.0
@anal0gK1d Looks like you updated your global install instead of your project's. Is it okay now?
Will this be hotfixed anyway ?
I'm getting the error:
cannot read property 'sync' of undefined
And cannot update prettier for now
Same issue here with 0.39.0. I don't have prettier in my project. I only have it inside atom.
I'm experiencing the same issue as @tleunen
npm install prettier --save-dev in a project folder solved the issue.
Same issue here with 0.39.0. I don't have prettier in my project. I only have it inside atom.
The bundled version of prettier has resolveConfig.sync defined, so you might have some sort of weird caching problem. I would try uninstalling and reinstalling the package and restarting Atom and seeing if that fixes it.
Will this be hotfixed anyway ?
Since people are still having problems, I will try and make a PR over at prettier-eslint to make a conditional check instead of hard-erroring like this.
thanks a lot @BroFox86 yarn add prettier -D indeed solved the issue!
Adding prettier to my dev dependencies did nothing to resolve this issue for me. Any other ideas??
@ffxsam In your case, I would also try to add prettier-eslint or/and prettier-eslint-cli mentioned by @robwise.