【问题标题】:Path file not found找不到路径文件
【发布时间】:2020-11-18 14:25:00
【问题描述】:

我正在尝试在 Jekyll 中使用一些 jQuery 代码,但我的控制台中出现此错误:

[2020-11-18 15:15:40] 找不到错误“/node_modules/jquery/dist/jquery.min.js”。
[2020-11-18 15:15:40] 找不到错误'/node_modules/popper.js/dist/umd/popper.min.js'。

这是我的代码:

<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>

我也试过了:

<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>

我的配置文件:

# Site settings
# http://jekyllrb.com/docs/configuration/
title: Datalab Project
email: meryem.achemlal@alterway.fr
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: []

请看截图

enter image description here

enter image description here

【问题讨论】:

  • 你试过./node_modules/jquery/dist/jquery.min.js./node_modules/popper.js/dist/umd/popper.min.js吗?
  • 是的,同样的问题
  • 您尚未向我们展示您的服务器配置。为什么这些 URL 应该正确解析?
  • 目录中是否存在这些文件?
  • @juanmajmjr 谢谢这是解决方案:)

标签: javascript html jquery jekyll


【解决方案1】:

&lt;script&gt; 标记移动到该部分而不是&lt;body&gt; 部分。

您的问题可能与查找javascript资源时的jQuery有关,也可能与资源的顺序有关。

【讨论】:

    猜你喜欢
    • 2015-08-25
    • 1970-01-01
    • 1970-01-01
    • 2014-06-17
    • 2012-09-03
    • 2013-08-10
    • 2017-03-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多