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

mkdir(): Invalid path #97

Open
neo-brendan opened this issue Feb 18, 2016 · 8 comments
Open

mkdir(): Invalid path #97

neo-brendan opened this issue Feb 18, 2016 · 8 comments

Comments

@neo-brendan
Copy link

I am getting an "[ErrorException] mkdir(): Invalid path" when trying to use this to install some (but not all) magento modules.
pasted image at 2016_01_29 17_40

I have about 20 modules that work perfectly and then another 8 or so that throw this error. I have checked the modman and composer files per module and there doesn't seem to be any visible errors.

@AydinHassan
Copy link
Contributor

could you try run composer install -vvv please?

@Flyingmana
Copy link
Contributor

could you also provide the mapping the failing modules use? (modman,package.xml, "map" element in composer.json?)

@neo-brendan
Copy link
Author

image

This is a different module with the same outcome.
Id like to point out that these are modules on company repos.

What package.xml file? and what map element in the composer.json file? I dont know of (or have) either of these. Below is the modman file
image

@kirkmadera
Copy link

kirkmadera commented Oct 3, 2016

I also encountered on algolia/algoliasearch-magento. This only occurs when using the "copy" strategy. The symlink strategy works as expected.

Trace:

Analyzed 93 packages to resolve dependencies
Analyzed 121 rules to resolve dependencies
  - Installing magento-hackathon/magento-composer-installer (2.0.0-beta2)
    Downloading
    Extracting archive

  - Installing fxp/composer-asset-plugin (v1.2.1)
    Downloading
    Extracting archive

  - Installing algolia/algoliasearch-magento (dev-master c91d4f4)
    Cloning c91d4f4d2784efe619ebedb202f797a0f2f50283 from cache



  [ErrorException]
  mkdir(): Invalid path


Exception trace:
 () at /var/www/myproject/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:103
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 mkdir() at /var/www/myproject/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:103
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /var/www/myproject/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeplAbstract.php:242
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /var/www/myproject/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystr.php:66
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /var/www/myproject/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeplAbstract.php:242
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /var/www/myproject/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/DeploystroystrategyAbstract.php:70
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->deploy() at /var/www/myproject/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Installer
 MagentoHackathon\Composer\Magento\Installer->install() at phar:///home/dev/bin/robofirm/composer/src/Composer/Installer/InstallationManager.php:173
 Composer\Installer\InstallationManager->install() at phar:///home/dev/bin/robofirm/composer/src/Composer/Installer/InstallationManager.php:160
 Composer\Installer\InstallationManager->execute() at phar:///home/dev/bin/robofirm/composer/src/Composer/Installer.php:542
 Composer\Installer->doInstall() at phar:///home/dev/bin/robofirm/composer/src/Composer/Installer.php:216
 Composer\Installer->run() at phar:///home/dev/bin/robofirm/composer/src/Composer/Command/InstallCommand.php:135
 Composer\Command\InstallCommand->execute() at phar:///home/dev/bin/robofirm/composer/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at phar:///home/dev/bin/robofirm/composer/vendor/symfony/console/Application.php:847
 Symfony\Component\Console\Application->doRunCommand() at phar:///home/dev/bin/robofirm/composer/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///home/dev/bin/robofirm/composer/src/Composer/Console/Application.php:231
 Composer\Console\Application->doRun() at phar:///home/dev/bin/robofirm/composer/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar:///home/dev/bin/robofirm/composer/src/Composer/Console/Application.php:104
 Composer\Console\Application->run() at phar:///home/dev/bin/robofirm/composer/bin/composer:43
 require() at /home/dev/bin/robofirm/composer:24

@kirkmadera
Copy link

kirkmadera commented Oct 3, 2016

This occurs after deploying via the symlink strategy, then deploying later via the copy strategy. magento-force: true must be enabled in order for this to get far enough to hit this error. This also only occurs also in cases where the modman file source and path are not identical.

Example:

Algolia_Algoliasearch.xml                   app/etc/modules/Algolia_Algoliasearch.xml
code                                        app/code/community/Algolia/Algoliasearch/
design/frontend/layout/algoliasearch.xml    app/design/frontend/base/default/layout/algoliasearch.xml
design/frontend/template                    app/design/frontend/base/default/template/algoliasearch
skin                                        skin/frontend/base/default/algoliasearch
js                                          js/algoliasearch
lib/AlgoliaSearch                           lib/AlgoliaSearch/

When copying code to htdocs/app/code/community/Algolia/Algoliasearch and htdocs/app/code/community/Algolia/Algoliasearch is symlinked to vendor/algolia/algoliasearch-magento/code from a previous install, the installer creates a new directory code instead of htdocs/app/code/community/Algolia/Algoliasearch, thus creating a new directory vendor/algolia/algoliasearch-magento/code/code. The recursive directory iterator picks up this new directory and keeps going down and down until eventually mkdir fails. You can see this if you add var_dump($subDestPath); at line 103.

To reproduce (with composer.json with hackathon module already installed):

composer config repositories.algoliasearch-magento vcs https://github.com/algolia/algoliasearch-magento.it;
composer config extra.magento-force true;
composer config extra.magento-deploystrategy symlink;
composer require algolia/algoliasearch-magento;

# Reinstall via copy strategy
composer config extra.magento-deploystrategy copy;
rm -rf vendor;
composer install;

@kirkmadera
Copy link

kirkmadera commented Oct 3, 2016

The fix for this may be a built in redeploy script. We have a bash script that we use that looks something like this:

packageInfo=$(composer info);
cp composer.json composer.json.bak;
cp composer.lock composer.lock.bak;
composer config discard-changes true;

IFS="\n";
readarray -t lines <<<"$packageInfo";
IFS=" ";
packageNames="";
for line in "${lines[@]}"; do
   packageName=$(cut -f1 -d" " <<<"$line");
   if [[ $packageName == *"/"* ]] && [[ ! 'aydin-hassan/magento-core-composer-installer' = $packageName ]] && [[ ! 'magento-hackathon/magento-composer-installer' = $packageName ]] && [[ ! 'aydin-hassan/magento-core-composer-installer' = $packageName ]]; then
        packageNames="$packageNames $packageName";
    fi
done
composer remove $packageNames --no-interaction;
mv composer.json.bak composer.json;
mv composer.lock.bak composer.lock;
composer install;

It removes all installed composer packages, then reinstalls them.

@Morgy93
Copy link

Morgy93 commented Aug 30, 2017

Same error here - any chance we can work on this?
I basically got the same error as above, so I don't think I have to provide it again.

Meanwhile I'll have a look at the composer.json which seems to cause the error and see if I can find something suspicious.

@Morgy93
Copy link

Morgy93 commented Aug 31, 2017

Alright, that one was easy.
The composer.json contained:

            [
                "src/skin/frontend/base/default/images/patterns/*",
                    "skin/frontend/base/default/images/patterns/*"
            ],

So it tried to create the * folder which of course is wrong.

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

No branches or pull requests

5 participants