【发布时间】:2019-10-22 21:54:28
【问题描述】:
我一直在 Gatsby 中进行调整,到目前为止,它为静态网站提供了无缝的功能。我有堆栈,我需要使用引导程序设计布局,就布局而言引导程序运行良好,但对于下拉轮播或模式等额外支持,我必须使用 bootstrap.js,它的依赖项虽然在本地环境中一切正常,但当我在将我的网站部署到我们的 netlify 我正面临这个问题
4:25:02 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
4:25:01 PM: 7 | //# sourceMappingURL=bootstrap.min.js.map
4:25:01 PM:
4:25:01 PM: WebpackError: TypeError: Cannot set property 'emulateTransitionEnd' of undefin ed
4:25:01 PM:
4:25:01 PM: - bootstrap.min.js:6
4:25:01 PM: [lib]/[bootstrap]/dist/js/bootstrap.min.js:6:2564
4:25:01 PM:
4:25:01 PM: - bootstrap.min.js:6 ./node_modules/bootstrap/dist/js/bootstrap.min.js
4:25:02 PM: Shutting down logging, 58 messages pending
在官方 repo 和谷歌上进一步挖掘了这个问题之后,大多数人都推荐 react-bootstrap 或 reactstrap 但我非常喜欢 bootstrapjs 并且无法找到解决上述错误的正确方法是无论如何还是最好的方法包括引导 js?这是我的 package.json 文件。
"dependencies": {
"bootstrap": "^4.3.1",
"gatsby": "^2.8.2",
"gatsby-image": "^2.1.2",
"gatsby-plugin-manifest": "^2.1.1",
"gatsby-plugin-offline": "^2.1.1",
"gatsby-plugin-react-helmet": "^3.0.12",
"gatsby-plugin-react-svg": "^2.1.1",
"gatsby-plugin-sass": "^2.0.11",
"gatsby-plugin-sharp": "^2.1.3",
"gatsby-source-filesystem": "^2.0.38",
"gatsby-transformer-sharp": "^2.1.21",
"jquery": "^3.4.1",
"node-sass": "^4.12.0",
"popper.js": "^1.15.0",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-helmet": "^5.2.1"
},
"devDependencies": {
"prettier": "^1.17.1"
},
提前感谢您!
【问题讨论】:
-
可能是个愚蠢的问题,但您的项目中是否存在
./node_modules/bootstrap/dist/js/bootstrap.min.js? -
@An0nC0d3r 显然是的,检查 json 包,它在本地环境中运行良好,到目前为止,我已经在我的导航栏中使用 bootstrapjs 作为下拉菜单,它在本地运行良好,所以它确实存在。
标签: javascript reactjs twitter-bootstrap bootstrap-4 gatsby