简体   繁体   中英

jquery.js and jquery.keyframes.js are not found when using NPM

I'm having trouble using jquery and jquery.keyframes. I use NPM and the js files are stored in the node_modules folder while the html files are stored in the public folder. For some reason the html file cannot find the js files when I use this code:

<script src="../node_modules/jquerykeyframes/dist/jquery.keyframes.js"></script>
<script src="../node_modules/jquery/dist/jquery.js"></script>

I've tried a few alternatives but nothing has worked. What am I doing wrong?

You shouldn't be importing your node_modules this way. You can either set a script up with node import/export (or require) or just use the jquery cdn like so ( https://code.jquery.com/ ):

<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>

And here is the link for jquery keyframes cdn: https://cdnjs.com/libraries/jquerykeyframes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM