getsentry / sentry-laravel

The official Laravel SDK for Sentry (sentry.io)
https://sentry.io
MIT License
1.26k stars 189 forks source link

[RuntimeException] Could not delete /home/vagrant/code/*********/vendor/composer/package-versions-deprecated/src: #414

Closed ezdotjs closed 4 years ago

ezdotjs commented 4 years ago

Hello,

I've seen some other posts that reference something to do with package-versions but they seem to be regarding previous php versions and I'm a little confused.

I get the following error when attempting to install:

[RuntimeException]
Could not delete /home/vagrant/code/*****/vendor/composer/package-versions-deprecated/src:

(I've obfuscated the project name)

I'm running Laravel Homestead, and the project is enforcing php 7.4 in the Homestead.yaml file

My composer version is 2.0.5

My composer.json has:

"require": {
        "php": "^7.4.0",
        ...
}

and

"config": {
        ...
        "platform": {
            "php": "7.4.4"
        }
    },

I've tried deleting my vendors folder and the composer.lock, to no avail

stayallive commented 4 years ago

I have no clue what is going on here and I really need some more info if I want to try to help you 😄

We do use the package versions package but I doubt it's directly related to our code, so it could be caused by one of our dependencies but not sure why you are here (at the Sentry repo), are you using Sentry for Laravel?

With the current information the only thing I can think of is a permissions problem...

I want to know why you are now getting this error, are you newly installing Sentry on Laravel or is it an upgrade? What version of Sentry Laravel (and Sentry SDK)? Can you share the full error stacktrace? Can you share your full composer.json?

Hopefully you can provide some more info so I can help you out!

ezdotjs commented 4 years ago

Hi there, you're quite right I'm using this on Laravel 7, I've used Sentry in the past on other projects but this is a first time install for this particular one. I added the platform php version and changed the require php version hoping it might fix it, but it did not (if you're wondering why they're in there)

composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.4.0",
        "cartalyst/sentinel": "^4.0",
        "erusev/parsedown-extra": "^0.8.1",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^1.0",
        "guzzlehttp/guzzle": "~6.0",
        "iio/libmergepdf": "^4.0",
        "jackiedo/log-reader": "^2.1",
        "jenssegers/agent": "^2.6",
        "laravel/framework": "^7.0",
        "laravel/tinker": "^2.0",
        "phpoffice/phpspreadsheet": "^1.15",
        "rcrowe/twigbridge": "^0.11.3",
        "spatie/dropbox-api": "^1.15",
        "tenancy/framework": "^1.0",
        "tenancy/identification-driver-http": "^1.0",
        "tymon/jwt-auth": "^1.0"
    },
    "require-dev": {
        "facade/ignition": "^2.0",
        "fzaninotto/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^4.1",
        "phpunit/phpunit": "^8.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "platform": {
            "php": "7.4.4"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories",
            "themes"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

Here's the verbose output from the install:

vagrant@homestead:~/code/quanta$ composer require sentry/sentry-laravel -v
Using version ^2.2 for sentry/sentry-laravel
./composer.json has been updated
Running composer update sentry/sentry-laravel
Loading composer repositories with package information
Updating dependencies
Dependency resolution completed in 0.002 seconds
Analyzed 889 packages to resolve dependencies
Analyzed 1890 rules to resolve dependencies
Dependency resolution completed in 0.000 seconds
Lock file operations: 16 installs, 0 updates, 0 removals
Installs: composer/package-versions-deprecated:1.11.99, clue/stream-filter:v1.5.0, http-interop/http-factory-guzzle:1.0.0, php-http/message-factory:v1.0.2, php-http/promise:1.1.0, symfony/polyfill-uuid:v1.20.0, symfony/options-resolver:v5.1.8, php-http/message:1.9.1, php-http/httplug:2.2.0, php-http/discovery:1.12.0, php-http/client-common:2.3.0, symfony/http-client:v5.1.8, jean85/pretty-package-versions:1.5.1, sentry/sentry:3.0.4, sentry/sdk:3.0.0, sentry/sentry-laravel:2.2.0
  - Locking clue/stream-filter (v1.5.0)
  - Locking composer/package-versions-deprecated (1.11.99)
  - Locking http-interop/http-factory-guzzle (1.0.0)
  - Locking jean85/pretty-package-versions (1.5.1)
  - Locking php-http/client-common (2.3.0)
  - Locking php-http/discovery (1.12.0)
  - Locking php-http/httplug (2.2.0)
  - Locking php-http/message (1.9.1)
  - Locking php-http/message-factory (v1.0.2)
  - Locking php-http/promise (1.1.0)
  - Locking sentry/sdk (3.0.0)
  - Locking sentry/sentry (3.0.4)
  - Locking sentry/sentry-laravel (2.2.0)
  - Locking symfony/http-client (v5.1.8)
  - Locking symfony/options-resolver (v5.1.8)
  - Locking symfony/polyfill-uuid (v1.20.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 16 installs, 0 updates, 0 removals
Installs: composer/package-versions-deprecated:1.11.99, clue/stream-filter:v1.5.0, http-interop/http-factory-guzzle:1.0.0, php-http/message-factory:v1.0.2, php-http/promise:1.1.0, symfony/polyfill-uuid:v1.20.0, symfony/options-resolver:v5.1.8, php-http/message:1.9.1, php-http/httplug:2.2.0, php-http/discovery:1.12.0, php-http/client-common:2.3.0, symfony/http-client:v5.1.8, jean85/pretty-package-versions:1.5.1, sentry/sentry:3.0.4, sentry/sdk:3.0.0, sentry/sentry-laravel:2.2.0
  - Installing composer/package-versions-deprecated (1.11.99): Extracting archive
Plugin initialization failed (include(/home/vagrant/code/quanta/vendor/composer/package-versions-deprecated/src/PackageVersions/Installer.php): failed to open stream: No such file or directory), uninstalling plugin
  - Removing composer/package-versions-deprecated (1.11.99)
    Install of composer/package-versions-deprecated failed

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

  [RuntimeException]                                                                           
  Could not delete /home/vagrant/code/quanta/vendor/composer/package-versions-deprecated/src:  

Exception trace:
 () at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:218
 Composer\Util\Filesystem->unlink() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:171
 Composer\Util\Filesystem->removeDirectoryPhp() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:138
 Composer\Util\Filesystem->removeDirectory() at phar:///usr/local/bin/composer/src/Composer/Downloader/FileDownloader.php:379
 Composer\Downloader\FileDownloader->remove() at phar:///usr/local/bin/composer/src/Composer/Downloader/DownloadManager.php:348
 Composer\Downloader\DownloadManager->remove() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:292
 Composer\Installer\LibraryInstaller->removeCode() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:187
 Composer\Installer\LibraryInstaller->uninstall() at phar:///usr/local/bin/composer/src/Composer/Installer/PluginInstaller.php:119
 Composer\Installer\PluginInstaller->rollbackInstall() at phar:///usr/local/bin/composer/src/Composer/Installer/PluginInstaller.php:78
 Composer\Installer\PluginInstaller->Composer\Installer\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/FulfilledPromise.php:20
 React\Promise\FulfilledPromise->then() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:74
 React\Promise\Deferred->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:166
 React\Promise\Deferred->processQueue() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:95
 React\Promise\Deferred->resolve() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/FulfilledPromise.php:20
 React\Promise\FulfilledPromise->then() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:76
 React\Promise\Deferred->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:166
 React\Promise\Deferred->processQueue() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:95
 React\Promise\Deferred->resolve() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/FulfilledPromise.php:20
 React\Promise\FulfilledPromise->then() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:76
 React\Promise\Deferred->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:166
 React\Promise\Deferred->processQueue() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:95
 React\Promise\Deferred->resolve() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/FulfilledPromise.php:20
 React\Promise\FulfilledPromise->then() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:76
 React\Promise\Deferred->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:166
 React\Promise\Deferred->processQueue() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:95
 React\Promise\Deferred->resolve() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/FulfilledPromise.php:20
 React\Promise\FulfilledPromise->then() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:76
 React\Promise\Deferred->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:166
 React\Promise\Deferred->processQueue() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:95
 React\Promise\Deferred->resolve() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Promise.php:42
 React\Promise\Promise->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php:279
 Composer\Util\ProcessExecutor->countActiveJobs() at phar:///usr/local/bin/composer/src/Composer/Util/Loop.php:90
 Composer\Util\Loop->wait() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:442
 Composer\Installer\InstallationManager->waitOnPromises() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:432
 Composer\Installer\InstallationManager->executeBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:362
 Composer\Installer\InstallationManager->downloadAndExecuteBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:261
 Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:714
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:546
 Composer\Installer->doUpdate() at phar:///usr/local/bin/composer/src/Composer/Installer.php:251
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/RequireCommand.php:321
 Composer\Command\RequireCommand->doUpdate() at phar:///usr/local/bin/composer/src/Composer/Command/RequireCommand.php:240
 Composer\Command\RequireCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:310
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:122
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:63
 require() at /usr/local/bin/composer:24

require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>]...
stayallive commented 4 years ago

Thanks for the extra info, I think I was right about the permission issue, but I must be honest that I am not a 100% sure how to fix it, I don't use Vagrant/Homestead myself.

But looking at this Stack Overflow response it does look like your exact issue (but without homestead): https://stackoverflow.com/a/63014300/1580028.

But I also found this thread on the Homestead repo that might help you: https://github.com/laravel/homestead/issues/1240#issuecomment-555951201.

For a sanity check I did try your composer.json just in case it was a non-homestead related issue but it installs just fine for me (the classic it works on my machine 😉).

I hope those 2 links will help get to a solution!

ezdotjs commented 4 years ago

@stayallive Thank you, going off this information I tried using composer outside of vagrant and on the Mac itself and it installed without a problem