I am developing a Magento 2.3 site which was working but has stopped. When I try to get a page up, I get a blank screen. Although it looks empty, it actually contains a little content:
<!doctype html>
<html lang="en">
<head >
<meta charset="utf-8"/>
<meta name="description" content="Blah Blah"/>
<meta name="keywords" content="More blah blah"/>
<meta name="robots" content="INDEX,FOLLOW"/>
<title></title>
<link rel="icon" type="image/x-icon" href="http://www.magento2.domain/pub/media/favicon/stores/1/3-ladies-bg.jpg" />
<link rel="shortcut icon" type="image/x-icon" href="http://www.magento2.domain/pub/media/favicon/stores/1/3-ladies-bg.jpg" />
<link href='https://fonts.googleapis.com/css?family=Prosto+One' rel='stylesheet' type='text/css' />
<!--xxxabb2c66c7681e8f658-->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxx-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-131267613-1');
</script> </head>
<body data-container="body" data-mage-init='{"loaderAjax": {}, "loader": { "icon": "http://www.magento2.domain/pub/static/version1551796553/frontend/_view/en_GB/images/loader-2.gif"}}' class="cms-index-index page-layout-1column">
</body>
</html>
If I look in the system log, I see the following errors:
[2019-04-30 21:24:48] main.INFO: Broken reference: the 'theme.active.editor' element cannot be added as child to 'after.body.start', because the latter doesn't exist [] []
[2019-04-30 21:24:48] main.INFO: Broken reference: the 'logger' element cannot be added as child to 'after.body.start', because the latter doesn't exist [] []
I've enabled error logging but I get nothing. Can anyone help?
Alternatively, can somebody point me to a good map (or similar) of how magento 2 builds a page so I can try and track down the error.
I have tracked down the issue to a problem with pub/generated/metadata/global.php. Even regenerating it causes the same problem. If I delete the file everything seems to work ok. I confess to not understanding why!
I now avoid this by not running bin/magento setup:di:compile. I simply run php bin/magento setup:static-content:deploy.
I think this error is due to a broken reference in some XML file. You have not mentioned in which page you are getting this error. But you can trace it as below:
First of all, rename your default.xml from below path:
app/design/frontend/Vendor/Theme_name/Magento_Theme/layout/default.xml
Flush all the cache and check(php bin/magento cache:flush)
If you don't find anything then rename your page(homepage, listing, detail page, etc) related file.
For example, if you are getting this error on the homepage then rename cms_index_index.xml.It can reside in your theme or any custom extension.
Hopefully, this information can help you with the issue.
remove everything under generated folder except .htaccess file
I am using Magento 2.3.2 version. In production mode generating generated directory using setup:di:compile is working fine. However, in developer mode doing same is making all pages on frontend blank but not empty (content inside body tag is empty) so I deleted the generated folder and let it be created automatically as I access the site pages. Doing this resolved the issue for me.
Just go to Magento directory and then delete file generated by di:compile is path :-
magento\generated\metadata\global.php delete this file then after refersh your page.
This is temporary solution for this error in local server.
Related
I downloaded my laravel project from live serve (shared hosting) to local hosting because I want to make some changed in the code. I added a new index.php file to the public folder and run composer update and composer install commands and managed to run the project on local server (I use Laragon server on windwos). However, the project can not upload the resource. The resource are located in the public floder and linked using {{asset}} function and {{assetversion}} methods. Honestly, I do not know about the use of version. The code in like that
<link rel="stylesheet" href="{{ asset('public/frontend/infixlmstheme') }}/css/fontawesome.css{{assetVersion()}} ">
<link rel="stylesheet" href="{{asset('public/backend/css/themify-icons.css')}}{{assetVersion()}}"/>
<link rel="stylesheet" href="{{ asset('public/frontend/infixlmstheme') }}/css/flaticon.css{{assetVersion()}}">
<link rel="stylesheet" href="{{ asset('public/frontend/infixlmstheme') }}/css/nice-select.css{{assetVersion()}}">
<link rel="stylesheet" href="{{ asset('public/frontend/infixlmstheme') }}/css/notification.css{{assetVersion()}}">
<link rel="stylesheet" href="{{ asset('public/frontend/infixlmstheme/css/mega_menu.css') }}">
When I check the path in chrom dev tools, the link points to the right folder (except the version in not in the file name). such as
<link rel="stylesheet" href="http://127.0.0.1:8000/public/frontend/infixlmstheme/css/fontawesome.css?v=5.0.0 ">
and the folder in with same path starting from public.
However, the recourse is not connected and the error massage is shown in the attached image fro chrom dev tools.
I appreciate you help guys and thank you in advance for your time and expertise.
I have assempution the error is from {{assetversion}} but I could not find the version in the file name. I do not know a lot about the frontend how the asset version work.
I have been able to deploy Laravel projects successfuly in the past.
For the first time I am using Laravel 8 with Jetstream and Livewire. Laravel is now using Fortify for login and registration auth.
My local server works perfect, no issues. After deploying the project to a Hostgator shared hosting account, my homepage loads correctly and reads and outputs data from my DB correctly.
However, when I try to access
mydomain.com/login/ or mydomain.com/login
or
mydomain.com/register/ or mydomain.com/register
I get a 500 error. Below at the end of this question I am pasting the error log.
I have done the following:
Updated composer version
npm rebuild
npm install
I tried both: npm run dev and npm run production and re-uploaded everything in each scenario.
I have pointed public/index.php path to the correct app folder to read the autoload.php and bootstrap/app.php files.
I have chmod all folders and subfolders to 755 and all files to 644
I find it really strange that my homepage loads flawless and brings data from DB just fine, therefore I know that my .env file has the correct db connection credentials. Only the login and registration will throw a 500 error.
My env file:
APP_NAME=NameOfApp
APP_ENV=production
APP_KEY=base64:KeyGeneratedWhenProjectCreated
APP_DEBUG=false
APP_URL=http://domain
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=db_works_good
DB_USERNAME=username_works_good
DB_PASSWORD=passwordWorksGood
Here is the laravel.log (shortened to what seems important):
[2020-11-30 20:25:34] production.ERROR: The Mix manifest does not exist. (View: /domain_root_path/app/resources/views/layouts/guest.blade.php) (View: /domain_root_path/app/resources/views/layouts/guest.blade.php) {"exception":"[object] (ErrorException(code: 0): The Mix manifest does not exist. (View: /domain_root_path/app/resources/views/layouts/guest.blade.php) (View: /domain_root_path/app/resources/views/layouts/guest.blade.php) at /domain_root_path/app/vendor/laravel/framework/src/Illuminate/Foundation/Mix.php:46)
[stacktrace]
#0 /domain_root_path/app/vendor/livewire/livewire/src/CompilerEngine.php(38): Illuminate\\View\\Engines\\CompilerEngine->handleViewException(Object(ErrorException), 0)
#1 /domain_root_path/app/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(60): Livewire\\CompilerEngine->handleViewException(Object(ErrorException), 0)
#2 /domain_root_path/app/vendor/livewire/livewire/src/LivewireViewCompilerEngine.php(32): Illuminate\\View\\Engines\\PhpEngine->evaluatePath('/home2/usr2...', Array)
...................
#52 /domain_root_path/public_html/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#53 {main}
[previous exception] [object] (Exception(code: 0): The Mix manifest does not exist. at /domain_root_path/app/vendor/laravel/framework/src/Illuminate/Foundation/Mix.php:46)
[stacktrace]
#0 /domain_root_path/app/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(506): Illuminate\\Foundation\\Mix->__invoke('/css/app.css')
#1 /domain_root_path/app/storage/framework/views/f25b68bee7f180a7da8624828693071be98325dc.php(14): mix('css/app.css')
#2 /domain_root_path/app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(107): require('/home2/usr2...')
............................................
#66 {main}
THE STRUCTURE OF FILES:
root has two folders:
app (has all files except public folder)
public_html : has all public content including index.php
My index.php (inside public) has the following paths:
require __DIR__.'/../app/vendor/autoload.php';
$app = require_once __DIR__.'/../app/bootstrap/app.php';
GUEST.BLADE.PHP looks like this:
(please note that this file was auto-generated by Laravel and I have not touched it)
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito:wght#400;600;700&display=swap">
<!-- Styles -->
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine#v2.7.3/dist/alpine.js" defer></script>
</head>
<body>
<div class="font-sans text-gray-900 antialiased">
{{ $slot }}
</div>
</body>
</html>
/public/mix-manifest.json:
{
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css"
}
If you read below the error there is a hint about the solution :
Error's screenshot with a hint
You missed npm install && npm run dev
I replaced
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
with
<link rel="stylesheet" href="/css/app.css/">
and it works now.
The error happens because of two reasons:
you have to run npm install && npm run dev
if npm run dev command occurs error, please upgrade your node.js version to latest.
Please consider this question:
Based on https://golang.org/doc/tutorial/call-module-code, I've:
$ cat hello.go
package main
import (
"fmt"
"example.com/greetings"
)
func main() {
// Get a greeting message and print it.
message := greetings.Hello("Gladys")
fmt.Println(message)
}
and,
$ cat go.mod
module hello
go 1.14
replace example.com/greetings => ../greetings
require example.com/greetings v0.0.0-00010101000000-000000000000
It loads the greetings module from my local folder, and goes its way.
In real life, greetings is a module I use a lot, so I lug that folder around a lot so I can use my it.
To avoid this, how can I setup my own URL of this folder, and use it? That is, I can copy that folder to say, https://mywebsite.com/myGoThings/greeting - just a plain apache server which is open for GETs. (I do not want to use github, I'd prefer my own https endpoint.)
When I try this, go get mywebsite.com/myGoThings/greeting complains : no go-import meta tags () and quits.
If this is possible, could you please show me how to accomplish this?
update 1
This is my greetings folder as in mywebsite.com/myGoThings/greeting:
$ ls greetings/
go.mod greetings.go import.html
import.html:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- Go Imports -->
<meta name="go-import" content="GOIMPORT">
<meta name="go-source" content="GOSOURCE">
<meta http-equiv="refresh" content="0; REDIRECT">
</head>
<body>
</body>
</html>
When you have any custom domain else github.com, gitlab.com, etc. The first step is to add a ssh-key to your system, then set the GOPRIVATE environment variable. after a logoff you can use your own private repository.
The official golang documentation describes how to that.
I need to create a static version of a Joomla website. I'm using wget to download files. But the downloaded files have a base url that point to the live site.
If I remove the tag, then the local files become a mess, since references to css, javascript etc. start with a slash and Chrome errors with "Not allowed to load local resource"
Here some source code from the downloaded site:
<base href="http://www.example.com/" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Home - My Site</title>
<link href="/templates/mytemplate/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
<link href="/templates/mytemplate/css/template.css" rel="stylesheet" type="text/css" />
<link href="/templates/mytemplate/css/custom.css" rel="stylesheet" type="text/css" />
<script src="/templates/mytemplate/js/template.js" type="text/javascript"></script>
Does anyone have an idea how to create a good local static copy of a site? What setting am I maybe missing in wget?
To make a really static copy of a site, you need to specify both -k (--convert-links) and -p (--page-requisites):
$ cd <target-dir>
$ wget -k -p http://www.example.com
$ cd www.example.com
$ firefox index.html
This is not Joomla specific, though.
In Laravel, I’ve in public/css/app.css the following:
body { background: "red"; }
It’s linked to my layout like this:
<link rel="stylesheet" href="/css/app.css" media="screen" title="no title" charset="utf-8">
But when I go to the home page, the style isn’t applied to the body. I checked the source and the CSS file is there!
I removed the cache but nothing happened. This problem start after I added version() to elixir but after that I removed all the build folder, now I can’t get the style working.
When you use version() in elixir the filename changes. You can add following helper
<link rel="stylesheet" href="{{ elixir('css/app.css') }}">
this will always return the correct file name.
Refer to the documentation for versioning and cache busting.
Also make sure you run the gulp command again since you deleted the build folder.
I think you need to use asset to refer/link to files in public folder
<link rel="stylesheet" href="{{asset('/css/app.css')}}" media="screen" title="no title" charset="utf-8">
You should write this. This is Laravel predefined Function
{{ HTML::style('css/app.css'); }}