aaronlord / laroute

Generate Laravel route URLs from JavaScript.
MIT License
794 stars 139 forks source link

Template laroute.js not found when executing laroute:generate from outside the base application install folder #80

Closed percymamedy closed 1 year ago

percymamedy commented 6 years ago

I am using deployer to deploy my site to production. One of the tasks I defined was as follows

task('artisan:laroute:generate', function () {
    run('{{bin/php}} {{release_path}}/artisan laroute:generate');
});

However I get the following error when deploying:

Executing task artisan:laroute:generate
[mysite.com] > /usr/local/bin/php ~/releases/12/artisan laroute:generate
[mysite.com] < stdin: is not a tty
[mysite.com] < File does not exist at path vendor/lord/laroute/src/templates/laroute.js

When running the command manually on the server it works.

Any ideas ?

martdegraaf commented 6 years ago

Did you do it after the composer install?

percymamedy commented 6 years ago

I actually found the issue was that when executing artisan from outside the base install folder the path of the template files could not be resolved.

For example if my application was installed in /var/www and I was in /var trying to execute php artisan like so :

$ /var: php www/artisan laroute:generate 

The path defined in config laroute.php broke down and could not be resolved since it was looking in the /var folder.

This PR should get it fixed : https://github.com/aaronlord/laroute/pull/81