Skip to content
This repository has been archived by the owner on Apr 22, 2019. It is now read-only.

setup:di:compile error using manual install of AvaTax module #2

Closed
inspiredchu opened this issue Mar 15, 2016 · 10 comments
Closed

setup:di:compile error using manual install of AvaTax module #2

inspiredchu opened this issue Mar 15, 2016 · 10 comments

Comments

@inspiredchu
Copy link

When this line as per your documentation:

composer require avalara/avatax:14.4.4

it installs the avalara/avatax module in the magneto/vendor folder. When you run:

php bin/magento setup:di:compile, you get the following error:

[Magento\Framework\Exception\FileSystemException]
Invalid path: /var/www/html/magento/app/code/ClassyLlama/AvaTax/../../avalara/avatax

I solved this by moving the files from the magento/vendor folder to the magento/app/code folder.

Hope this helps someone in the future.

@erikhansen
Copy link
Contributor

I never ran into this issue when testing. If anyone else is able to reproduce this issue, I'll take another look and try to reproduce it.

@erikhansen
Copy link
Contributor

@inspiredchu Do you get this issue if you run the compiler in multi tenant mode?

@inspiredchu
Copy link
Author

I didn't test it compiling in multi tenant mode, but I believe that the source of the error comes from the ClassyLlama_AvaTax/registration.php file. In it, you register both modules... ClassyLlama_AvaTax and avalara/avatax:

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'ClassyLlama_AvaTax',
    __DIR__
);

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::LIBRARY,
    'Avalara_AvaTax',
    __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'avalara' . DIRECTORY_SEPARATOR . 'avatax'
);

I believe the problem occurs when the modules are in different module folders (app/code vs vendor). If the user installs both modules using composer, then both will be in the /vendor folder. I believe the issue will only pop up if the user uses composer to install one module and then manually installs another module in the app/code folder.

@erikhansen
Copy link
Contributor

@inspiredchu Oh, that makes sense. I'll add this to our backlog to fix. Thanks for reporting.

@hiephm
Copy link

hiephm commented Mar 29, 2016

@erikhansen Not sure why do you need to add Avalara_AvaTax to registration.php? I think it is autoloaded by PSR-4 already (same way as monolog or braintree)

@erikhansen
Copy link
Contributor

@hiephm Good point. I'll test to see if I can remove that next time I work on this extension.

@davidalger
Copy link

The file should simply look like this…

<?php

use \Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(ComponentRegistrar::MODULE, 'ClassyLlama_AvaTax',  __DIR__);

It's kind a the point of using the magic constant ;)

@samtay
Copy link
Contributor

samtay commented Apr 28, 2016

@davidalger That is what the file usually looks like, but it is perfectly fine to register more than one module in a registration.php file (the fact that the registration file exists is what gives you flexibility in defining and specifying the location of the module). For instance I am developing a "conglomerate module" that has a single registration.php, but registers five submodules in __DIR__ . DIRECTORY_SEPARATOR . 'ModuleName'.

However, I would say there is an issue with the current avatax registration.php, because it is assuming a /vendor directory structure.

@lindyk
Copy link

lindyk commented Oct 12, 2017

With the latest version 1.2.0, I still have an issue when I try to do bin/magento setup:di:compile
[Magento\Framework\Exception\FileSystemException]
Invalid path: /Users/lindy/sites/project/vendor/avalara/avatax

When I tried to manually create avalara/avatax directory under vendor, it passes that state and give different exception:

[ReflectionException]
Class AvaTax\ValidateRequestFactory does not exist
[ReflectionException]
Class AvaTax\ValidateRequestFactory does not exist
[RuntimeException]
Source class "\AvaTax\ValidateRequest" for "AvaTax\ValidateRequestFactory" generation does not exist.

I am running in developer mode and PHP 7.0.22

Because of this failure, when I tried to go to checkout/cart page, I got an error
3 exception(s):
Exception #0 (ReflectionException): Class ClassyLlama\AvaTax\Framework\Interaction\TaxCalculation\Proxy does not exist
Exception #1 (ReflectionException): Class ClassyLlama\AvaTax\Framework\Interaction\TaxCalculation\Proxy does not exist
Exception #2 (RuntimeException): Class AvaTax\GetTaxResult does not exist

@erikhansen
Copy link
Contributor

@lindyk We've had a number of people report these types of issues, and it's typically related to not exactly following the installation instructions. Can you follow the instructions here, and if you still have an issue, open a new Github issue? Thanks.

@classyllama classyllama locked and limited conversation to collaborators Oct 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants