Problems with Composer when uninstalling a package


In the application I have installed Composer (I did not do it myself) and with it several libraries. Now you have stopped using one of them and you have to uninstall it.

As it was installed with Composer I think it should be uninstalled with it, to avoid problems (I do not want to delete the folder directly).

The library that you want to uninstall is Report .

I access the server, remotely with Putty .

So far what I have done is the following:

  • Connecting to the server remotely as a root user
  • Access the folder where composer.phar is found
  • Execute composer.phar with php composer.phar
  • So far simple, I am shown the following screen:

    ############ /var/www#php composer.phar

    Do not run Composer as root/super user! See link for details

      / ____/___  ____ ___  ____  ____  ________  _____
     / /   / __ \/ __ '__ \/ __ \/ __ \/ ___/ _ \/ ___/
    / /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
    \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
    Composer version 1.4.1 2017-03-10 09:29:45
      command [options] [arguments]
      -h, --help                     Display this help message
      -q, --quiet                    Do not output any message
      -V, --version                  Display this application version
          --ansi                     Force ANSI output
          --no-ansi                  Disable ANSI output
      -n, --no-interaction           Do not ask any interactive question
          --profile                  Display timing and memory usage information
          --no-plugins               Whether to disable plugins.
      -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
      -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
    Available commands:
      about           Short information about Composer
      archive         Create an archive of this composer package
      browse          Opens the package's repository URL or homepage in your browser.
      clear-cache     Clears composer's internal package cache.
      clearcache      Clears composer's internal package cache.
      config          Set config options
      create-project  Create new project from a package into given directory.
      depends         Shows which packages cause the given package to be installed
      diagnose        Diagnoses the system to identify common errors.
      dump-autoload   Dumps the autoloader
      dumpautoload    Dumps the autoloader
      exec            Execute a vendored binary/script
      global          Allows running commands in the global composer dir ($COMPOSER_HOME).
      help            Displays help for a command
      home            Opens the package's repository URL or homepage in your browser.
      info            Show information about packages
      init            Creates a basic composer.json file in current directory.
      install         Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
      licenses        Show information about licenses of dependencies
      list            Lists commands
      outdated        Shows a list of installed packages that have updates available, including their latest version.
      prohibits       Shows which packages prevent the given package from being installed
      remove          Removes a package from the require or require-dev
      require         Adds required packages to your composer.json and installs them
      run-script      Run the scripts defined in composer.json.
      search          Search for packages
      self-update     Updates composer.phar to the latest version.
      selfupdate      Updates composer.phar to the latest version.
      show            Show information about packages
      status          Show a list of locally modified packages
      suggests        Show package suggestions
      update          Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.
      validate        Validates a composer.json and composer.lock
      why             Shows which packages cause the given package to be installed
      why-not         Shows which packages prevent the given package from being installed

    ############ /var/www#

    Problem 1 - Composer is not started as root

    On the one hand, a message appears telling me:


    Do not run Composer as root / super user! See link for details

    Which I do not understand because I'm like root and I've used sudo su .

    Since my English is very poor I did not realize it was a simple advice that I should not run this file in root .

    Problem 2 - Can not find composer.json

    At the time of executing any Composer command, it returns the following messages:

  • Same message as problem 1 :

    Do not run Composer as root / super user! See link for details

  • A message that shows you can not find the composer.json file:

    Composer could not find a composer.json file in / var / www   To initialize a project, please create a composer.json file as described in the link "Getting Started" section

    The composer.json file is located in a folder other than composer.phar :

    How do I indicate the path of the JSON file?

    Problem 3 - Is the file actually installed with Composer ?

    This is where I lose most of the truth, in theory, from what I've been reading, the installed packages appear in the composer.json file. If you delete the lines where the package is referenced, you can delete the folder and have the package uninstalled.

    When I access composer.json only one installed package appears, and it's not the one I want to uninstall.

    But despite that, I have my doubts as to whether that is the correct file (that's why I wanted to list the installed packages, to be sure), since in the folder where the composer.json should go > (from what I've been reading) is a vendor .

    Here are two folders:

  • slim (the framework that appears in the composer.json )
  • composer
  • Inside slim we have the composer.json file and it appears that only this package is installed.

    Within composer we have several PHP and one JSON named installed.json and inside there are more lines referencing to slim .

    Note: I have looked at the Reporter package to see if there is another composer.json file but there is nothing

    I would like to have a solution to these problems and finally that is really why I show these problems is ... How should I uninstall the package Report ?


    I have decided to delete the folder manually, apparently it has not generated any problems in the application (I have checked).

    It may have been installed manually and not installed with the Composer (despite what I was told).

    asked by Lombarda Arda 01.06.2017 в 12:35

    1 answer


    Even though you have solved the problem, I will leave the answer in case someone has served you.

    Generally Composer can be installed locally (for the concrete project) or globally, the latter being the most common. When it is installed locally, the composer.phar and composer.json files will be located in the same directory in the root of the project, and will use the < strong> / vendor / on the same level to install the necessary dependencies.

    To remove a package Composer provides the command remove , we must bear in mind that the command will search for the file composer.json in the current directory, that is, in which we are located, since this file contains a json object with all the dependencies installed by composer.

    composer remove Nombre_del_paquete

    Composer Documentation:


    answered by 20.07.2017 / 15:52