简体   繁体   English

当运行“serve -s build”在本地为我的 React 构建文件夹提供服务时,没有内容呈现

[英]When running "serve -s build" to serve my React build folder locally, no content renders

In my browser console, I get these errors:在我的浏览器控制台中,我收到以下错误:

Uncaught SyntaxError: Unexpected token '<' 2.e1e7f2e0.chunk.js:1未捕获的语法错误:意外的标记 '<' 2.e1e7f2e0.chunk.js:1

Uncaught SyntaxError: Unexpected token '<' main.c36879cd.chunk.js:1未捕获的语法错误:意外的标记 '<' main.c36879cd.chunk.js:1

Manifest: Line: 1, column: 1, Syntax error.清单:行:1,列:1,语法错误。 :5000/React-Portfolio/manifest.json:1* :5000/React-Portfolio/manifest.json:1*

My app was built with create-react-app.我的应用程序是用 create-react-app 构建的。 It runs fine locally when I'm not running from the build folder.当我不在构建文件夹中运行时,它在本地运行良好。 It has no back end.它没有后端。

Thoughts?想法?

I needed to remove "homepage": XXX from my package.json.我需要从我的 package.json 中删除“主页”:XXX。

I found my solution here: https://newbedev.com/create-react-app-build-uncaught-syntaxerror-unexpected-token我在这里找到了我的解决方案: https : //newbedev.com/create-react-app-build-uncaught-syntaxerror-unexpected-token

我需要从我的 package.json 中删除“主页”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我有 nginx 正在运行,但它不适合我的反应构建 - I have nginx running but it doesn't serve my react build React serve -s build,“服务”一词未被识别为 cmdlet 的名称 - React serve -s build, The term 'serve' is not recognized as the name of a cmdlet 使用“serve -s build”来提供反应应用程序时,静态 img 不显示 - When using "serve -s build" to serve react app, static img does not show up “serve -s build”返回“serve: command not found” - "serve -s build" returns "serve: command not found" 如何在Koa中投放构建文件夹? - How to serve build folder in Koa? 将反应构建作为烧瓶中的模板 - Serve react build as a template in flask Next Js 在使用服务时显示构建文件夹的索引 - Next Js showing index of build folder when using serve 无法为我的 React 应用程序运行 serve -s build inside docker 图像 - Unable to run serve -s build inside docker image for my react application 我如何在我的反应构建中为摩纳哥编辑器的 loader.js 及其对本地主机的依赖项提供服务 - How do I serve Monaco editor's loader.js and its dependencies on localhost in my react build 如何使用 docker 和 serve -s build 部署 React 应用程序 - How to deploy React app with docker and serve -s build
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM