静态文件不可访问 – NextJS Plesk .js/.css 扩展名更改为 .jsundefined/.cssundefined

huangapple go评论55阅读模式
英文:

Static files not accessible - NextJS Plesk .js/.css extension changed to .jsundefined/.cssundefined

问题

我在Plesk服务器上部署了一个NextJS应用。之前它正常运行,我在布局中做了一些更改并推送了更新,从那时起,新版本和备份都无法正常工作。

错误显示静态文件(JS和CSS)不可用,并显示404错误。导致这个错误的原因是它在所有URL的末尾添加了undefined,我不知道它是从哪里来的,我找不到类似的情况。因此,所有CSS和JS文件的扩展名都变成了.cssundefined.jsundefined,从URL中移除undefined可以正常工作,并且文件的内容在浏览器中打开。

我一直在使用next build命令,以前配置都正常。而且,更改仅涉及布局文件,只与少数布局元素相关。

相同的代码在本地主机上正常工作,无论是在开发模式还是生产模式下。

你可以在NextJS的Github存储库上找到我提出的问题链接在这里

英文:

I've a NextJS app deployed on Plesk server. It was working properly, I changed something in layout and pushed an update, since then, neither the new nor the backup is working.

The error states that the static files (JS and CSS) files are not available and gives a 404 error. The reason for this error is it's adding undefined at the end of all the URLs and I've no clue where is it coming from, I've found nothing similar to this one. Because of this, all CSS and JS files' extensions have changed to .cssundefined and .jsundefined, removing the undefined from the url works and the file's content opens in the browser.

I've been using the command next build and it was working with the same config properly. Also, the changes were only in a layout file, related to only few layout elements.

The same code is working properly at localhost, in both development and production mode.

You can find the issue I've filed on NextJS's Github repo here.

静态文件不可访问 – NextJS Plesk .js/.css 扩展名更改为 .jsundefined/.cssundefined

静态文件不可访问 – NextJS Plesk .js/.css 扩展名更改为 .jsundefined/.cssundefined

答案1

得分: 0

这个问题与 NextJS 的版本 13.2.413.2.5 有关,与我的代码无关。

在 NextJS 的官方存储库上提出讨论后,提供的解决方案是在你的 package.json 文件中将 NextJS 版本降级并锁定为 13.2.1

你可以在这里找到提供的解决方案。

PS:他们预计会出现这个问题的 bug 浪潮。

英文:

The issue is related to NextJS's versions 13.2.4 and 13.2.5 and not related to my code.

After filing a discussion thread on the official repository of NextJS, the solution provided is to downgrade and lock your NextJS version to 13.2.1 in your package.json file.

You can find the solution provided here.

静态文件不可访问 – NextJS Plesk .js/.css 扩展名更改为 .jsundefined/.cssundefined

PS: They're expecting a bug wave for this.

huangapple
  • 本文由 发表于 2023年6月12日 19:53:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76456405-2.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定