What @tunji-oyeniran said worked for me.
I installed prettier globally, like he said:
npm i prettier -g
Then I looked inside my computer to find it

I saw using pwd command that the path is correct, then I moved to vscode and I looked for that extinsion path:

I restarted the vscode and I saw that formating code is working.
This si my settings.json:
{
"editor.minimap.enabled": false,
"editor.fontSize": 12,
"editor.formatOnSave": true,
"editor.tabSize": 2,
"liveServer.settings.donotShowInfoMsg": true,
"editor.wordWrap": "on",
"workbench.iconTheme": "material-icon-theme",
"emmet.triggerExpansionOnTab": true,
"emmet.showSuggestionsAsSnippets": true,
"editor.snippetSuggestions": "top",
"[javascript]": {
// "editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": true
},
"workbench.colorTheme": "Monokai",
"window.zoomLevel": 0,
"editor.columnSelection": false,
"explorer.compactFolders": false,
"typescript.updateImportsOnFileMove.enabled": "always",
"javascript.updateImportsOnFileMove.enabled": "always",
"liveServer.settings.donotVerifyTags": true,
// "javascript.format.enable": true,
"prettier.prettierPath": "/usr/local/lib/node_modules/prettier",
}
The prettier path was added automatically here, in this settings.json.