mozart icon indicating copy to clipboard operation
mozart copied to clipboard

Error File already exists at path

Open kupoback opened this issue 4 years ago • 3 comments

I'm trying to use this package over php-scoper, as php-scoper is rather complicated and confusing to implement, however, when I try to run vendor/bin/mozart compose I keep running into this error:

In Filesystem.php line 406:
  File already exists at path: vendor_prefix/packages/Doctrine/Inflector/Inflector.php  

I've tried to do what was suggested here, but that didn't resolve anything for me.

This is my package.json

{
	"name": "cs/ms-scraper",
	"require": {
		"php": ">=7.4",
		"illuminate/support": "^5.6",
		"guzzlehttp/guzzle": "^7.3",
		"mailjet/mailjet-apiv3-php": "^1.5",
		"monolog/monolog": "^2.3",
		"10quality/wp-query-builder": "^1.0",
		"nesbot/carbon": "^2.31"
	},
	"require-dev": {
		"squizlabs/php_codesniffer": "^3.5",
		"roave/security-advisories": "dev-master",
		"coenjacobs/mozart": "dev-master",
		"cweagans/composer-patches": "*"
	},
	"config": {
		"optimize-autoloader": true,
		"preferred-install": "dist"
	},
	"minimum-stability": "dev",
	"prefer-stable": true,
	"scripts": {
		"post-root-package-install": [
			"\"vendor/bin/mozart\" compose",
			"composer dump-autoload"
		],
		"post-root-package-update": [
			"\"vendor/bin/mozart\" compose",
			"composer dump-autoload"
		],
		"test": [
			"phpcs"
		]
	},
	"extra": {
		"mozart": {
			"dep_namespace": "MS\\Vendor\\",
			"dep_directory": "/vendor_prefix/packages/",
			"classmap_directory": "/vendor_prefix/classes/",
			"classmap_prefix": "MS_",
			"delete_vendor_directories": true
		}
	}
}

Any suggestions?

kupoback avatar Aug 19 '21 15:08 kupoback

When I try to add the patches to the composer.json file, I get this:

- Applying patches for coenjacobs/mozart
    https://github.com/coenjacobs/mozart/pull/91.patch (Move each file only once (classmap))
   Could not apply patch! Skipping. The error was: Cannot apply patch https://github.com/coenjacobs/mozart/pull/91.patch

I added it under my extra field like so, based on the #89 issue.

"patches": {
    "coenjacobs/mozart": {
        "Move each file only once (classmap)": "https://github.com/coenjacobs/mozart/pull/91.patch"
    }
},

kupoback avatar Aug 19 '21 15:08 kupoback

@kupoback check #136, you can also use it as patch in composer.json

Dartui avatar Mar 02 '22 13:03 Dartui

So, understandably due to availability, this took a bit long to get back to me on and I had to move off of using this. However, coming back to it on another project, I am now encountering a new error, where I am getting the following message in terminal.

In my classmap_directory if I remove the trailing slash, it works until another error appears, but I'm not exactly sure what is going on, or what I am missing.

In Finder.php line 592:
                                                                                                                                           
  The "/home/user/Sites/functionplayground/web/app/plugins/rap-site-reset/vendor_prefix/classes//wp-cli/wp-cli" directory does not exist.  
                                                                                                                                           

compose

This is my composer.json file, if I messed anything up, but I don't think I am missing anything?

{
	"name": "kupoback/rap-site-reset",
	"description": "",
	"type": "wordpress-muplugin",
	"require": {
		"composer/installers": "^2.0",
		"ext-json": "*",
		"illuminate/support": "^7.0",
		"php": ">=7.4",
		"phpseclib/phpseclib": "dev-master",
		"wp-cli/db-command": "^2.0",
		"wp-cli/extension-command": "^2.0",
		"wp-cli/maintenance-mode-command": "2.x-dev"
	},
	"require-dev": {
		"squizlabs/php_codesniffer": "4.0.x-dev",
		"roave/security-advisories": "dev-master",
		"coenjacobs/mozart": "dev-master",
		"cweagans/composer-patches": "*"
	},
	"config": {
		"optimize-autoloader": true,
		"preferred-install": "dist",
		"allow-plugins": {
			"composer/installers": true,
			"cweagans/composer-patches": true
		}
	},
	"license": "MIT",
	"scripts": {
		"post-root-package-install": [
			"\"vendor/bin/mozart\" compose",
			"composer dump-autoload"
		],
		"post-root-package-update": [
			"\"vendor/bin/mozart\" compose",
			"composer dump-autoload"
		],
		"test": [
			"phpcs"
		]
	},
	"authors": [
		{
			"name": "kupoback"
		}
	],
	"minimum-stability": "dev",
	"extra": {
		"mozart": {
			"classmap_directory": "/vendor_prefix/classes/",
			"classmap_prefix": "RapReset_",
			"delete_vendor_directories": false,
			"dep_directory": "/vendor_prefix/packages/",
			"dep_namespace": "RapReset\\Vendor\\"
		},
		"patches": {
			"coenjacobs/mozart": {
				"Move each file only once (classmap)": "https://github.com/coenjacobs/mozart/pull/91.patch",
				"Skip duplicate files": "https://github.com/coenjacobs/mozart/pull/136.patch"
			}
		}
	}
}

kupoback avatar Mar 23 '22 21:03 kupoback