admin管理员组文章数量:1313171
Getting these error codes on my github pages. I have these as my order of loading scripts:
<script src="../../node_modules/jquery/dist/jquery.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script src="../../js/index.js"></script>
Here are the error messages:
GET .js 404 ()
index.html:115 GET .js/dist/popper.min.js 404 ()
util.js:56 Uncaught TypeError: Cannot read property 'fn' of undefined
at util.js:56
at util.js:10
at bootstrap.min.js:6
at bootstrap.min.js:6
(anonymous) @ util.js:56
(anonymous) @ util.js:10
(anonymous) @ bootstrap.min.js:6
(anonymous) @ bootstrap.min.js:6
Heres my page: /
Other than the order of loading, what else could be causing this?
Getting these error codes on my github pages. I have these as my order of loading scripts:
<script src="../../node_modules/jquery/dist/jquery.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script src="../../js/index.js"></script>
Here are the error messages:
GET https://tmolano.github.io/CareerMod4/node_modules/jquery/dist/jquery.js 404 ()
index.html:115 GET https://tmolano.github.io/CareerMod4/node_modules/popper.js/dist/popper.min.js 404 ()
util.js:56 Uncaught TypeError: Cannot read property 'fn' of undefined
at util.js:56
at util.js:10
at bootstrap.min.js:6
at bootstrap.min.js:6
(anonymous) @ util.js:56
(anonymous) @ util.js:10
(anonymous) @ bootstrap.min.js:6
(anonymous) @ bootstrap.min.js:6
Heres my page: https://tmolano.github.io/CareerMod4/
Other than the order of loading, what else could be causing this?
Share Improve this question asked Sep 21, 2018 at 21:45 XoaksXoaks 531 gold badge2 silver badges7 bronze badges 5-
1
The first line clearly shows the problem:
GET https://tmolano.github.io/CareerMod4/node_modules/jquery/dist/jquery.js 404 ()
. The path does not exist and the jQuery library is not loaded. – Ram Commented Sep 21, 2018 at 21:49 - @RachelGallen "load jquery scripts at the top of your html , not the bottom". That doesn't change anything. The path to jQuery library does not exist! – Ram Commented Sep 21, 2018 at 21:57
- @undefined in the website, the scripts are loaded at the end of the page – Rachel Gallen Commented Sep 21, 2018 at 22:05
-
@RachelGallen You can load the scripts at the end of a page. OP just needs to move them into the end of the
body
tag. – Ram Commented Sep 21, 2018 at 22:11 - @RachelGallen ah...I forgot to add my node_modules folder. Also thanks for pointing out tag location. – Xoaks Commented Sep 21, 2018 at 22:13
2 Answers
Reset to default 6Possible reasons for this error:
Uncaught TypeError: Cannot read property 'fn' of undefined
- invalid reference to the file addresses or missing files (Your case).
- Duplicate reference to the Jquery.
- Overriding $ sign of Jquery in 3rd party libraries.
- Using Jquery functions before inserting Jquery (Not your case).
- Using deprecated syntax for load,error,unload on WINDOW element in jquery without
on
Update 2023:
I used this code snippet to fix all the problems I had!
As of bootstrap 5 they will require you to use their Proper . And here I use Bundle and it still works well with all functions
for nextjs 13
<Script type="text/javascript" src="https://ajax.googleapis./ajax/libs/jquery/3.4.0/jquery.min.js" />
<Script type="text/javascript" src="https://unpkg./@popperjs/core@2" />
<Script
type="text/javascript"
src="https://cdn.jsdelivr/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossOrigin="anonymous"
/>
本文标签: javascriptCannot read property of 39fn39 of undefinedStack Overflow
版权声明:本文标题:javascript - Cannot read property of 'fn' of undefined? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741921834a2405049.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论