Creating new laravel project and this error came up - laravel

Creating new laravel project and this error came up
[ErrorException]
chdir(): No such file or directory (errno 2)

it means that your Laravel Application Can't Find the public folder.
I got it to work by
changing :
chdir($this->laravel->publicPath());
In:
vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php
To:
chdir('/');

Related

Failed to open stream: No such file or directory using Laravel Forge

I'm using LiveWire for my Laravel project, and I'm trying to deploy using Laravel Forge but I encountered an Internal Server Error 500. I changed the .env to APP_DEBUG=true and APP_ENV=local.
Now I see the following error:
file_get_contents(/home/forge/officialmonte.co/vendor/livewire/livewire/src/../dist/manifest.json): Failed to open stream: No such file or directory (View: /home/forge/officialmonte.co/resources/views/layouts/app.blade.php) (View: /home/forge/officialmonte.co/resources/views/layouts/app.blade.php)
I thought the reason was because my project doesn't have a "dist" folder, and instead it named it as "build" folder. So I went to the file LivewireManager.php and changed the following code. My Project Folder
From this:
$manifest = json_decode(file_get_contents(__DIR__.'/../dist/manifest.json'), true);
$versionedFileName = $manifest['/livewire.js'];
To this:
$manifest = json_decode(file_get_contents(__DIR__.'/../build/manifest.json'), true);
$versionedFileName = $manifest['/livewire.js'];
But now I get this error instead:
file_get_contents(/home/forge/officialmonte.co/vendor/livewire/livewire/src/../build/manifest.json): Failed to open stream: No such file or directory (View: /home/forge/officialmonte.co/resources/views/layouts/app.blade.php) (View: /home/forge/officialmonte.co/resources/views/layouts/app.blade.php)
How can I solve this, and what is the error about? The thing that confuses me the most is that when I'm using my laptop to run the project (npm run dev), it works fine, but when I try to deploy, it breaks.

Manually installing/integrating a composer package

I tried installing this composer module on my Laravel app https://github.com/alihesari/laravel-social-auto-posting but im facing some issues. Im avoiding composer since it requires me to update my Laravel version which will break things (im runnin under 5.1.9).
Steps that I took so far:
1) wget https://github.com/alihesari/laravel-social-auto-posting/archive/master.zip - inside htdocs directory
2) unzipped master.zip and renamed folders. Moved folders inside /vendor/ folder under this structure:
/vendor/toolkito/larasap/ - This folder contains the src subfolder as shown in the repo.
3) Added this reference in \vendor\composer\autoload_namespaces.php and in \vendor\composer\autoload_psr4.php: 'Toolkito\\Larasap' => array($vendorDir . '/toolkito/larasap/src'),
4) Configured my secret keys in the config file, for the proper social media connection
5) Added use Toolkito\Larasap\SendTo; in the main controller, as per repo's instructions
6) Added SendTo::Twitter('Hello, I\'m testing Laravel social auto posting'); to a function that I use and ended up in this error:
FatalThrowableError in HomeController.php line 47:
Fatal error: Class 'Toolkito\Larasap\SendTo' not found
I also tried use Vendor\Toolkito\Larasap\SendTo; in step 5, and ended up with the same error message.
Any suggestions please?

Unable to generate resources using laravel-code-generator in Laravel 5.8

I created a fresh Laravel project v5.8. Then installed the latest version of the Laravel Code Generator (2.3) but I'm unable to generate resources. I've read your release notes for 2.3 and I'm not seeing where I'm making a mistake on the installation or the commands I keep the output below:
php artisan create:scaffold Test generates the output below:
Exception : The file
resources/laravel-code-generator/sources/tests.json was not found!
at /Users/Sites/Laravel/lms/vendor/crestapps/laravel-code-generator/src/Models/Resource.php:686
682| {
683| $fileFullname = Config::getResourceFilePath($filename);
684|
685| if (!File::exists($fileFullname)) {
> 686| throw new Exception('The file ' . $fileFullname . ' was not found!');
687| }
688|
689| return File::get($fileFullname);
690| }
Exception trace:
1 CrestApps\CodeGenerator\Models\Resource::jsonFileContent("tests.json")
/Users/Sites/Laravel/lms/vendor/crestapps/laravel-code-generator/src/Models/Resource.php:549
2 CrestApps\CodeGenerator\Models\Resource::fromFile("tests.json", "CrestApps")
/Users/Sites/Laravel/lms/vendor/crestapps/laravel-code-generator/src/Commands/Framework/CreateScaffoldCommand.php:70
Please use the argument -v to see more details.
I'm getting a similar output when trying to create resources from a database table. I'm using the php artisan resource-file:from-database [model-name] command.
I read online that it may have to do with the Laravel storage folder not having the correct permissions but I've tried that and it didn't work. Cleared and config the cache, composer dump-autoload, etc... But nothing has worked.
I'm also noticing that the generator does not publish the configuration file on your sample video on your website. I have tried to publish the config file using the vendor:publish command but it generates a somewhat empty file, only has this option: 'files_upload_path' => 'uploads'. The folder for the generator located inside the resources folder does not contain a config file.

View [layouts.app] not found in laravel

I have created an application in laravel using appzcoder crud-generator plug-in. i have done everything accordingly but i am getting the above mentioned error. I have a folder named layouts in views folder and this folder has app.stub in it. but when i run the project it gives the following error
View [layouts.app] not found. (View:C:\wamp64\www\myProject\resources\views\admin\items\index.blade.php)
make sure you have run below code if not run it will create layout.app path
or manually create view/layout/app.php
php artisan vendor:publish --provider="Appzcoder\CrudGenerator\CrudGeneratorServiceProvider"

Laravel new command error

I did the following commands:
composer global require "laravel/installer=~1.1"
and
set PATH=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
But when I try to do:
laravel new blog
I get the following error:
Notice: Undefined variable: output in C:\Users\****\AooDara\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 55
Fatal error: Call to a member function writeln() on null in C:\Users\****\AooDara\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 55
Any idea of what went wrong?
Seems like you already have a directory called 'blog' in your application directory. Try creating a laravel app with different name or delete / rename existing 'blog' directory and try again.
for example laravel new helloapp.
However, I think the error showing at the console is a bug of laravel new command. I could see the error at the console when I tried to create a app with same name again from same directory.
The error not exists now. Try creating other application.

Resources