【问题标题】:bootstrap javascript not working when deploying on Netlify在 Netlify 上部署时引导 javascript 不起作用
【发布时间】:2022-06-11 02:59:34
【问题描述】:

我正在尝试通过 Github 在 netlify 上部署我使用 bootstrap 和 sass 构建的网站。

我使用 npm 安装 sassbootstrap

该页面在我的本地计算机上运行正常。当我部署它时,除了移动菜单的 javascript 之外,一切似乎都正常工作。似乎引导程序中的 javascript 不起作用我为 node_modules 文件夹创建了一个 .gitignore。

部署站点后,我在控制台上收到错误“加载资源失败:服务器响应状态为 404 ()”,并且 javascript 是不工作。我已经尝试将 node_modules 文件夹提交到 GitHub 存储库,即使我已经阅读过它是一种不好的做法,但它也不起作用。

当我从 netlify 下载部署文件时,我看到 node_modules 文件夹不存在。

也许我需要从 node_modules 文件夹中取出 bootstrap js 文件夹?但是如果是这样的话,使用 npm 安装 bootstrap 有什么意义呢?

这是我的 package.json 文件:

{
  "name": "snap-website-project",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "bootstrap": "^5.1.3",
    "sass": "^1.52.1"
  }
}

【问题讨论】:

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: javascript html node.js netlify deploying


猜你喜欢
  • 2017-10-19
  • 2019-09-28
  • 1970-01-01
  • 2016-02-22
  • 2021-06-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多