Laravel 5 - Install TwitterOAuth library by Abraham - laravel

I am trying to install abraham's twitteroauth library (https://github.com/abraham/twitteroauth) in laravel 5 using composer. Added the project in composer.json like this
"require": {
"laravel/framework": "5.0.*",
"php": ">=5.4.0",
"abraham/twitteroauth": "0.5.2"
},
when i run composer update I receive an error at the end
- Installing abraham/twitteroauth (0.5.2)
Loading from cache
Writing lock file
Generating autoload files
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()
Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output:
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [packages1] ... [packagesN]
any help is Welcome

This isn't a problem with the library you are installing.
When Laravel v5.0.16 was released the compiled script location was changed and an upgrade guide was released. The unfortunate problem is that by running a composer update you would have upgraded to 5.0.16 without knowing any of this, as such you need to open bootstrap/autoload.php and change the $compiledPath variable.
// Change the current variable to this instead
$compiledPath = __DIR__.'/../vendor/compiled.php';
This will get it working again for you.

Related

Error when trying to install Laravel Via Composer

I already have Composer and XAMPP installed.
But when I try to use composer create-project laravel/laravel example-app command to create a new project by using Composer directly I throws some errors
C:\Users\HP>composer create-project laravel/laravel example-app
Creating a "laravel/laravel" project at "./example-app"
Installing laravel/laravel (v9.1.10)
- Installing laravel/laravel (v9.1.10): Extracting archive
Created project in C:\Users\HP\example-app
In CreateProjectCommand.php line 497:
chdir(): No such file or directory (errno 2)
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [<package> [<directory> [<version>]]]
C:\Users\HP>
I have tried:
Reinstalling Composer
Changing folder where I want to create my project
Using the composer global require laravel/installer
I'm using Composer version 2.3.7 and PHP Version 8.1.6. Im trying to install laravel 9 and my XAMPP is version 3.3.0
Did you try this ?
composer self-update
Same issue
Or you should change your installation directory.
cd desktop

Error installing Laravel: [ErrorException] file_get_contents(): read of 8192 bytes failed

This is the error:
Generating optimized autoload files
...
[ErrorException]
file_get_contents(): read of 8192 bytes failed with errno=9 Bad file descriptor
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [] [] [<version
...
This is usually a cache problem with composer. Either you have a slow connection (like me) or a process was interrupted during install/update.
Run composer clear-cache and try again. I hope this solves your problem.
Which PHP version are you using? cause this was a bug in PHP 7.4 as stated here :
https://bugs.php.net/bug.php?id=79166
Try using PHP 7.3, it should work fine

Hot to install laravel-vue-i18n-generator package?

I am trying to implement language translation in my app using the following plugin vue-i18n
I am following this documentation
https://github.com/martinlindhe/laravel-vue-i18n-generator
When I run the following code
composer require martinlindhe/laravel-vue-i18n-generator
in root#d722309335cd:/var/www#
I get the following error
root#d722309335cd:/var/www# composer require martinlindhe/laravel-vue-i18n-generator
Do not run Composer as root/super user! See https://getcomposer.org/root for details
---Using version ^0.1.30 for martinlindhe/laravel-vue-i18n-generator
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
[UnexpectedValueException]
/var/www/vendor/composer does not exist and could not be created.
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
What am I missing ?

api recipe can't be installed due to minimum-stability

I would like to use api-platform/api-platform in my flex-enabled symfony application. To do so, I run the following commands:
# creation of the flex-enable symfony application
composer create-project symfony/skeleton:3.3.* sf-flex
# installation of the api recip
composer req api
Unfortunately, I am getting this error message:
[InvalidArgumentException]
Could not find package api-platform/api-pack at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] []
To avoid that problem, I tried several solutions:
Solution 1
composer create-project symfony/skeleton:3.3.x-dev sf-flex
composer req api
SAME ERROR
Solution 2
composer create-project symfony/skeleton:3.3.x-dev sf-flex # a more recent version of symfony/skeleton
composer req --dev api
SAME ERROR
Solution 3
I tried to update the file composer.lock by changing that field as follows:
# "minimum-stability": "stable", # has been changed to to dev
"minimum-stability": "dev",
SAME ERROR
So, any proposal??
Thanks,
Based on this page, I just changed composer.json by adding this line:
"type": "project",
"license": "proprietary",
"minimum-stability": "dev", // the added line
"require": {
"php": "^7.1.3",
// ...
And the API recipe is installed without problems...

laravel installation failure with Composer

I was following a tutorial on Lynda.com, and I am completely new to the composer/laravel scene. The tutorial told me to install the MCrypt libarary, which I did successfully from this package:
topicdesk.com/downloads/mcrypt/mcrypt-download
Composer seems to be successfully installed/running.
I then went ahead and opened terminal, and put in the following command:
composer create-project laravel/laravel first_app --prefer-dist
Which resulted in the following error:
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
create-project [-s|--stability="..."] [--prefer-source]
[--prefer-dist] [--repository-url="..."]
[--dev] [--no-dev] [--no-plugins]
[--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs]
[--no-install] [package] [directory] [version]
Any ideas on what the issue may be? After looking around on the forums, it seems to me that it is a very case specific issue. Where do I begin in finding what may be preventing it from working correctly?

Resources