[英]When I deploy - Failed to load resource: the server responded with a status of 404 ()
<!-- Scripts -->
<script src="node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="js/scripts.js"></script>
I am not sure how get my css, bootstrap, and popper to display on the webpage when deployed.我不确定如何让我的 css、引导程序和弹出程序在部署时显示在网页上。 It works fine on local.
它在本地运行良好。
When you publish your site you don't have the node_modules folder on the server, don't worry you shouldn't have it there.当您发布您的站点时,您的服务器上没有 node_modules 文件夹,不用担心您不应该有它。 Replace the node_modules with cdn links instead.
将 node_modules 替换为 cdn 链接。 You will find alot of cdn sources on cdnjs.com, but a few libraries have their own (like bootstrap), here is jquery for example https://cdnjs.com/libraries/jquery .
您会在 cdnjs.com 上找到很多 cdn 资源,但一些库有自己的(如引导程序),这里是 jquery 例如Z5E056C500A1C4B6A7110B50D807BADE//cdquery.njs .
<!-- My links -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" />
<!-- Scripts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.