Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

585
Visualizações
laravel asset() doesnt find assets in public

I already put the folder named assets in my public folder and I should be able to access the assets like described on this page: https://laravel.com/docs/9.x/helpers#method-asset

But for some reason It wont load and the browser console gives this error:

Loading failed for the “http://localhost:8000/assets/js/jquery-3.4.1.min.js” when this should be the exact path

In the blade file I wrote this:

<script src="{{asset ('assets/js/jquery-3.4.1.min.js') }}"></script>

I already tried with URL::asset and It doesnt find the file

I made the symbolic link 'links' => [ public_path('storage') => storage_path('app/public'),

The real path of the file is /home/penta/ponti-gest/storage/app/public/assets/js

In my page I am using http

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

Based on your comments:

I already have the folder assets in my public/storage folder

@GiuseppeP. Is the public/storage folder a symbolic link?

yes I made the symbolic link 'links' => [ public_path('storage') => storage_path('app/public'), ],

Your file is in the storage path.

This is accessible by using:

storage_path()

The storage_path function returns the fully qualified path to your application's storage directory. You may also use the storage_path function to generate a fully qualified path to a given file within the storage directory:

storage_path('app/public/assets/js/jquery-3.4.1.min.js')

Addendum

Alternatively, you can use the asset() helper by prefixing the path with storage/.... I.e:

The Public Disk

The public disk included in your application's filesystems configuration file is intended for files that are going to be publicly accessible. By default, the public disk uses the local driver and stores its files in storage/app/public.

Once a file has been stored and the symbolic link has been created, you can create a URL to the files using the asset helper:

asset('storage/assets/js/jquery-3.4.1.min.js')
about 4 years ago · Juan Pablo Isaza Relatório

0

method asset() meaning go inside public folder so if it doesn't work

<script src="{{asset ('assets/js/jquery-3.4.1.min.js') }}"></script>

you should have in public folder assets folder then js folder then the file jquery-3.4.1.min.js

hopefully that help you

about 4 years ago · Juan Pablo Isaza Relatório

0

you must set ASSET_URL in your .env file.

then run

php artisan config:cache
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda