404 on assets when using Laravel Vite + Sail - laravel

I wanted to try out Sail on my Windows machine, however, after installing Breeze on a brand new installation of Laravel and running sail npm run dev I received a 404 in the browser for http://localhost/css/app.css and http://localhost/js/app.js when navigating to http://localhost/login on my Windows host.
Laravel Vite Plugin Version: v0.6.0
Laravel Version: v9.19
Node Version: v16.18.0
NPM Version: v8.19.2
Host operating system: Windows
Web Browser & Version: Firefox 106.0.2 (64-bit)
I am able to navigate to http://localhost:5173/ in the browser which displays the informative message, so we know that it is working. When using inspect element on the /login page the following URLs are returned as a 404: http://localhost/css/app.css & http://localhost/js/app.js.
In previous attempts I did try adding the following snippet to my vite.config.js file, however, it made no difference and the problem persisted.
server: {
hmr: {
host: 'localhost',
},
},
This is a fresh install of Docker, WSL2 and Laravel with Breeze so in theory, it should all be working, but clearly, something is awry.
The result is seeing this: https://i.imgur.com/FUZsIYh.png
If anybody could point me in the right direction I would really appreciate it!

Related

I've got an issue with using 'visit'

When my Cypress tests are run on Github (headless).
When I call visit('/page') - get a 404 error. The page definitely exists.
CypressError: 'cy.visit()' failed trying to load:
http://localhost:4200/page
I can run the same tests locally (headless and headed) and they work fine.
Anyone have any ideas why this could be?
I should add that this is an Angular Application and there are no 404's because all routes are handled with wildcard. I know this page exists and happens if i try to visit another page that exists.
Version:
"cypress": "^10.6.0",
This is the .yml file. The baseUrl is set to 'http://localhost:4200' in the 'integration.config.ts' file.
So found the answer.
We are serving the Angular application with 'http-server'. It was only recognising the route '/' and was returning a 404 for any other app routes / pages.
We fixed this by adding --proxy http://localhost:4200? to the http-server command.

How to custom strapi Admin UI v4?

I have tried to change the HomeHeader of the Admin page, but it has no changes.
I copy admin folder in node_modules/#strapi/admin/admin to my-project/admin and then I modified HomeHeader.js file as the image below:
I started strapi with the command yarn strapi develop --watch-admin, and nothing happened
Please help me to custom this! Thanks
Strapi Version: 4.0.4
Operating System: MacOs
Database: postgres Node
Version: v14.18.1
NPM Version: 6.14.15
Yarn Version: 1.22.10
In Strapi-v3 you can customize the admin panel UI, but in v4 you can't.
there is an opened issue in GitHub about this problem.
I also encountered this requirement of a client.
To replace or customize Strapi admin dashboard home, you can overwrite the file using webpack.
First make sure to install webpack-dev-server in devDependencies.
Create a component file in src/admin/components/Home.tsx with basic React component code.
on the file src/admin/webpack.config.js write this code to replace the original Home page.
module.exports = (config, webpack) => {
...
/**
* Overwrite the dashboard home Component
*/
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/.cache\/admin\/src\/pages\/HomePage\/index\.js/,
path.resolve(__dirname, "components/Home.tsx")
)
);
....
// Important: return the modified config
return config;
};
then re-build you app.

Laravel nova keeps throwing exception Route [nova.login] not defined

I've already posted this to https://github.com/laravel/nova-issues sadly hadn't got any love from there, so I'd like to know if anyone experienced this issue and how they resolved it.
Laravel Version: 5.7.27
Nova Version: 1.2
PHP Version: 7.2.12
Operating System and Version: MacOS 10.13.6
Browser type and version: Chrome (Latest) FireFox (Latest)
Description:
Whenever I access my nova route in /admin <-- (this is where my nova resides) I get this exception thrown from/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php line 389, throw new InvalidArgumentException("Route [{$name}] not defined."), my nova was installled correctly and currently I don't have any other existing app routes this is a fresh install of laravel and fresh install of nova.
It was working fine until I introduced the custom path.
Steps To Reproduce:
Change the 'path' => '/admin'
Run php artisan config:clear or php artisan config:cache
Check your NovaServiceProvider.php and make sure it has withAuthenticationRoutes() in the routes() function like this:
protected function routes()
{
Nova::routes()
->withAuthenticationRoutes()
->withPasswordResetRoutes()
->register();
}

Windows 10 PDOException with message 'could not find driver' Laravel 5.6.33 Wampserver 3.1.7 x86

I know there is a lot on this topic around StackOverflow, but my problem is that i have php extensions already uncommented, i have made the required changes to database.php and .env and i have declared and used the necessary environment path. The only thing i haven't done is install composer due to my proxy restrictions. I have a proxy that is over a kerberos windows AD, and for some reason nothing that used to work with proxy address, port and credentials (user and password) is working anymore, so i found this website to download php libraries and its dependencies without composerand managed to get Laravel 5.6.33 working or at least apparently, becouse when i tried to call:
C:\wamp\www\laravel> php artisan migrate:install i got the following error :Illuminate\Database\QueryException : could not find driver (SQL: create table "migrations" ("id" serial primary key not null, "migration" varchar(255) not null, "batch" integer not null))and the following Exception trace: `Exception trace:
1 PDOException::("could not find driver")
C:\wamp\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68
2 PDO::__construct("pgsql:host=localhost;dbname=tienda;port=5432", "postgres", "admin123", [])
C:\wamp\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68`
I have to say that i am working on windows 10 Version 10.0.17134.1 64 bits and my wamp server is 3.1.7 with php 7.2.14
Any help or pointer on this issue will be appreciated
After a lot of research and frustration, I thought on give it a try to xampp and what I found was that with xampp xampp-win32-7.3.0-0-VC15.exe installed, the correct extensions enabled in the php.ini
extension=pdo_pgsql
extension=pgsql
which in the xamp case is located at
C:\xampp\php
I set the path for xampp php in my Windows 10 Ent it is C:\xampp\php and later run the command
php C:\wamp\www\laravel> php artisan tinker
, after in the tinker console run
Psy Shell v0.9.9 (PHP 7.3.0 — cli) by Justin Hileman
>>> DB::connection()->getPdo()
And I got what I was hoping for:
=> PDO {#2863
inTransaction: false,
attributes: {
CASE: NATURAL,
ERRMODE: EXCEPTION,
PERSISTENT: false,
DRIVER_NAME: "pgsql",
SERVER_INFO: "PID: 1764; Client Encoding: UTF8; Is Superuser: on; Session Authorization: postgres; Date Style: ISO, MDY",
ORACLE_NULLS: NATURAL,
CLIENT_VERSION: "9.6.9",
SERVER_VERSION: "9.6.11",
STATEMENT_CLASS: [
"PDOStatement",
],
EMULATE_PREPARES: false,
CONNECTION_STATUS: "Connection OK; waiting to send.",
DEFAULT_FETCH_MODE: BOTH,
},
}
A response, which means that it found the driver that was always there and was able to use to access the database which was already installed and running.
The rest settings done in wamp with the virtual host and extensions enabled with the PHP version of 7.3.1 are the same and work like a charm.
I hope this may help others until the wamp and laravel teams find a way to make laravel
php artisan migrate
the command to work with wamp 3.1.7 for the x86 architecture alone.

Laravel "[b" character on version 4.1.x

Installed Laravel 4.1.30 (because I can't use 4.2 on a RHEL5 server - no PHP 5.4), all seemed to go OK, but noticed the sequence "[B" showing up when a user is logged into my test application.
I even see that just getting the Laravel version:
./artisan --version
[BLaravel Framework version 4.1.30
On v4.2, I'm not seeing that.
./artisan --version
Laravel Framework version 4.2.6
I cannot upgrade the version of Laravel on the server because of no PHP5.4 support (the server isn't mine). Any idea what is causing the stray "[B"? It's an issue because as I mentioned, it also shows up in my application.
e.g.
Section from a blade view:
#section('content')
(here1)
#if(Auth::check())
(auth)
#else
(not-auth)
#endif
(here2)
Displays this on the site:
(here1) [B (auth) (here2)
I had this issue at one point as well where I would get a "/" whenever I ran artisan commands etc.. it turned out I had a / before one of my opening <?php tags that I missed. /<?php. Just do a quick search/replace on the [B string in your project and hopefully you can locate the offending file.

Resources