![](/img/trans.png)
[英]How do I resolve the "Module not found: Can't resolve [css file] in [directory]" when deploying next.js site to Netlify?
[英]CSS and JS are not loading when i deploy the site on github, netlify
https://github.com/MadhavaY/RandomQuotesGenerator这里是存储库的链接。 HTML 正在加载,但 css 和 js 没有。 链接到网站https://madhavay.github.io/RandomQuotesGenerator/ 。 我也看到了其他答案,但我不知道我哪里出错了。
您需要更改两个文件的路径。 原样:
<script src="/All Projects/randomqotesproject/randomquotes.js"></script>
<link rel='stylesheet' type='css' media='screen' href='/All Projects/randomqotesproject/randomquotes.css'>
如果您删除路径,例如:
/All Projects/randomqotesproject/
它应该工作。
您好 madhava 我查看了您的项目,发现您仍在使用本地路径来链接您的 css 和 javascript
<link rel='stylesheet' type='css' media='screen' href='/All Projects/randomqotesproject/randomquotes.css'>
只需将/All Projects/randomqotesproject/randomquotes.css
为./randomquotes.css
如果更改路径对您不起作用,您可以轻松地将 URL 添加到 CSS 和 JS。 例如: https ://madhavay.github.io/RandomQuotesGenerator/randomquotes.css
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.