npm - 为什么我无法访问我网站的 aboutus.html 页面的 NPM 模块?
问题描述
找不到我的 aboutus.html 页面所需的 NPM 模块,并且出现 404 错误。不过,一切都适用于 index.html。
我查看了 NPM 服务器,解析的路径似乎是错误的:
19.01.20 22:33:07 304 GET /index.html
19.01.20 22:33:07 404 GET /aboutus.html/node_modules/bootstrap/dist/css/bootstrap.min.css
这是来自 Chrome 检查器:
http://localhost:3000/aboutus.html/node_modules/bootstrap/dist/js/bootstrap.min.js net::ERR_ABORTED 404 (Not Found)
这是我在代码中的路径:
<link rel="stylesheet" href="node_modules/bootstrap/dist/js/bootstrap.min.js">
aboutus.html 页面位于我的文件夹的根目录中,所以我不明白为什么 NPM 在我的路径前面添加 aboutus.html/。index.html 不会发生这种情况。
我已经尝试在路径前添加 / 和 ../ 但没有成功。
请多多包涵,因为这是我在这里的第一个问题,而且我也是 Web 开发领域的新手。谢谢!
解决方案
我解决了。问题在于从index.html页面到aboutus.html页面的链接方式错误。
这是之前的链接方式:
<a class="nav-link" href="./aboutus.html/">About</a>
这就是我将行更改为:
<a class="nav-link" href="aboutus.html">About</a>
我希望这对遇到同样问题的人有所帮助。
推荐阅读
- firebase - Cloud Firestore 查询以获取文档 ID,Flutter
- apache - 从凌晨 12:30 到凌晨 2 点阻止代理用户
- python - 如何在 {{ form.label }} 中输入默认值
- python - 在 python-telegram-bot 中每 15 分钟发送一次消息
- django - 我可以在 2 个场景中使用一个 Django Modelform 并使用不同数量的字段吗?
- ansible - Ansible - 使用 slurp 定义每个主机环境变量以读取远程主机上的文件
- javascript - Vuetify 如何将 fill-height 属性转换为 CSS “.fill-height” 类?
- python - 如何在 eel python 中使用 Jinja2 模板?
- c++ - 关于for循环的问题(初始化、条件、更新)
- python - 如何检查数据库字段的值是否已在 django 中更改?