Search code examples
javascripthtmljqueryjekyll

Path file not found


I'm trying to use some jQuery code in Jekyll, but I have this error in my console:

[2020-11-18 15:15:40] ERROR '/node_modules/jquery/dist/jquery.min.js' not found.
[2020-11-18 15:15:40] ERROR '/node_modules/popper.js/dist/umd/popper.min.js' not found.

This is my code:

<script src="{{'/node_modules/jquery/dist/jquery.min.js' | prepend: site.baseurl}}"></script>
<script src="{{'/node_modules/popper.js/dist/umd/popper.min.js' | prepend: site.baseurl}}"></script>

I also tried:

<script src="{{'../node_modules/jquery/dist/jquery.min.js' | prepend: site.baseurl}}"></script>
<script src="{{'../node_modules/popper.js/dist/umd/popper.min.js' | prepend: site.baseurl}}"></script>

My config file :

# Site settings
# http://jekyllrb.com/docs/configuration/
title: Datalab Project
email: [email protected]
description:  Datalab Project
baseurl: "" # the subpath of your site, e.g. /blog/
url: "" # the base hostname & protocol for your site
# twitter_username: tweetpressfr
github_username:  mery92

# Build settings
markdown: kramdown
sass:
    load_paths:
        - _sass
        - node_modules
        - assets/css
exclude: []

Please take a look at the screenshot too

enter image description here

enter image description here


Solution

  • Move the <script> tags to the section instead of the <body> section.

    Your problem can be related with jQuery when finding the javascript resources or related to the order of the resources.