I get this error one every save
This is the configuration in my vimrc file:
let g:prettier#config#print_width = 120
let g:prettier#config#bracket_spacing = 'false'
let g:prettier#quickfix_enabled = 1
let g:prettier#autoformat = 0
autocmd BufWritePre .js,.jsx,.mjs,.ts,.tsx,.css,.less,.scss,.json,.graphql Prettier
You need to update your global prettier to the latest version.
Done that already it's 1.7.0
Do you use nvm?
you mean node version manager?
Yes
no i dont
Did you updated vim-prettier. They released a new version three days ago.
yep
@damcatee the prettier CLI resolution will first look for local prettier installed on your project, then will look on the global one and if nothing is found will check on the vim-prettier installation directory.
Could you please check the following:
1 - are you running prettier in a folder of a project that have would have a node_modules directory somewhere along the parent ancestry? If any is found can you check the version for it ?
2 - confirm that prettier is installed globally and is accessible and is of Version 1.7+
3 - if no prettier is found globally go to your 'vim-prettier' installation directory and do either 'npm install' or 'yarn install'
If your are on a unix system you can also run locate "bin/prettier" to search for bin installations to help investigating where is the old prettier executable
Since you have mentioned that you have prettier installed globally it's most likely that along the parent ancestry of where you started your vim session you will find a node_modules folder that have an older version of prettier
Hi @danmcatee,
To avoid confusion I have just done a new vim-prettier release 0.1.1 which adds some new commands that can help debugging this issue:
:PrettierVersion - prints the vim-prettier plugin version :PrettierCli <q-args> - send commands to the resolved prettier cli :PrettierCliPath - check what is the resolved prettier cli path :PrettierCliVersion - check what is the resolved prettier cli version To further debug this issue I recomend the following steps:
vim-prettier:PrettierCliVersion to check the version of your prettier resolved CLI.:PrettierCliPath to check where is the installation of your prettier resolved CLI.Please let me know if that helps resolving your issue
Hi @danmcatee,
Will close this issue for now, if you feel like the above commands have no helped you identify the problem please feel free to re-open it.
I had the same problem that's due to a local installed version (version 1.3) of the project though my global version is the latest (1.7). Once I updated the local version to the latest, the problem is solved.
Is there a way to override and specify a specific path for prettier to vim-prettier? (I cannot update the version of prettier in a project i'm working on)
@magicmark currently there is not, but its a good idea, will create a task for it and see if I can deploy a new vim-prettier version with that option tonight.
In the meantime a work-around is delete the prettier local installation folder from the project you are working on node_modules/prettier that will than cause it to default to either the global prettier or the vim-prettier.
@magicmark created the task for it https://github.com/prettier/vim-prettier/issues/56 will try to get into it ASAP
@magicmark Just did new release of vim-prettier to version 0.1.2.
You should now be able to overwrite the default path by adding this flag to your .vimrc file:
" Set the prettier CLI executable path
let g:prettier#exec_cmd_path = "~/path/to/cli/prettier"
Hi @jojoyuji
Could you please confirm that:
:PrettierVersion
:PrettierCliVersion
:PrettierCliPath
Sometimes you may have the global installed prettier version of 1.7.4+ but you may be working on projects that still have the old prettier installed on their package.json and available on their node_modules in that case vim-prettier will resolve that prettier version instead of your global one
Quoting the comment from https://github.com/prettier/vim-prettier/issues/73#issuecomment-340854914 to this thread in case some other users may have been facing similar issue:
Woah, found the issue!
I had updated my prettier globaly indeed, however I realized that vim-prettier was using my current project's Prettier by running the :PrettierCliPath
Thx @mitermayer for the help.