Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while resolving package dependencies #349

Closed
victorsptt opened this issue Oct 11, 2023 · 4 comments
Closed

Error while resolving package dependencies #349

victorsptt opened this issue Oct 11, 2023 · 4 comments

Comments

@victorsptt
Copy link
Contributor

Do you want to request a feature or report a bug?

Report a bug.

What is the current/expected behavior?

Currently when running npm install from the directory of vim-plugin npm outputs an error message and does not install the dependencies. The message is:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/prettier
npm ERR!   prettier@"^3.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer prettier@"^1.15.0 || ^2.0.0" from @prettier/[email protected]
npm ERR! node_modules/@prettier/plugin-php
npm ERR!   @prettier/plugin-php@"^0.16.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

The expected behavior is that after running npm install all the package dependencies are installed without errors.

What version of vim-prettier are you using - (output of :PrettierVersion) ?

1.0.0

What version of prettier are you using - (output of :PrettierCliVersion) ?

3.0.3

What is your prettier executable path - (output of :PrettierCliPath) ?

/home/victorspt/.vim/pack/plugins/opt/vim-prettier/node_modules/.bin/prettier

Did this work in previous versions of vim-prettier and/or prettier ?

Yes.

@victorsptt
Copy link
Contributor Author

When I installed the latest versions of the dependencies it worked without errors.

npm install @prettier/plugin-lua@latest @prettier/plugin-php@latest @prettier/plugin-ruby@latest @prettier/plugin-xml@latest prettier-plugin-svelte@latest

npm install --save-dev colors@latest jest@latest vim-driver@latest

The versions in the package.json file then became:

  "dependencies": {
    "@prettier/plugin-lua": "^0.0.3",
    "@prettier/plugin-php": "^0.20.1",
    "@prettier/plugin-ruby": "^4.0.2",
    "@prettier/plugin-xml": "^3.2.1",
    "prettier": "^3.0.3",
    "prettier-plugin-svelte": "^3.0.3"
  },
  "devDependencies": {
    "colors": "^1.4.0",
    "jest": "^29.7.0",
    "vim-driver": "^1.0.1"
  }

@mitermayer
Copy link
Member

Hi Victor

Do you want to submit a PR to update the deps to match the above ?

@victorsptt
Copy link
Contributor Author

Hi Mitermayer,
Yes, I am writing a PR now.

@fbosio
Copy link

fbosio commented Jun 9, 2024

I have the same issue when trying to install prettier with Vundle in Ubuntu Jammy 64 bits. Here's a reproducible example I made with a Linux Container.

  1. Create, start and attach container from a terminal emulator.
    $ sudo su                                                                   
    # lxc-create --name reprex --template download -- --dist ubuntu --release jammy --arch amd64
    # lxc-start --name reprex                                                   
    # lxc-attach --name reprex                                                  
    
  2. Install Vundle inside the container.
    # apt install -y curl git
    # cd
    # git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
    # echo "set nocompatible                                                    
    filetype off                                                                
    set rtp+=~/.vim/bundle/Vundle.vim
    call vundle#begin()                                                         
    Plugin 'VundleVim/Vundle.vim'                                               
    Plugin 'prettier/vim-prettier'                                              
    filetype plugin indent on                                                   
    call vundle#end()                                                           
    " > .vimrc                                                                  
    
  3. Install vim-prettier by opening vim and running :PluginInstall.
    # vim                                                                       
    :PluginInstall
    
  4. Quit vim and try to install prettier with Node Package Manager.
    :qa!                                                                        
    # cd .vim/bundle/vim-prettier
    # curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
    # export NVM_DIR="$HOME/.nvm"
    # [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
    # [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
    # nvm install --lts
    # npm install
    
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/prettier
npm ERR!   prettier@"^3.0.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer prettier@"^1.15.0 || ^2.0.0" from @prettier/[email protected]
npm ERR! node_modules/@prettier/plugin-php
npm ERR!   @prettier/plugin-php@"^0.16.3" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /root/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2024-06-09T22_59_22_092Z-debug-0.log

I'm not an expert on npm so I'm not sure what's the cause of the issue, but hopefully my "reprex" above helps us tracking it.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants