在未转换为构建的 React 应用程序中向 package.json 添加主页字段
Adding a homepage field to package.json in react app not translating to build
我正在尝试使用 cPanel 向 GoDaddy 启动 React 应用程序 (create-react-app),但在创建正确的构建时遇到问题。我在 package.json 中的“名称”和“版本”下方设置主页(不确定此处的顺序是否重要),如下所示:
"homepage": "http://mydomainname.org"
但是,当我 运行 npm run build
时,我收到一条消息说 "The project was built assuming it is hosted at /. You can control this with the homepage field in your package.json.
有没有人遇到过这个问题?
该消息不是错误。在你 运行 npm run build
命令之后,一个名为 build 的文件夹应该出现,它包含你的 React 应用程序。您需要将该文件夹的内容上传到 cpanel 文件管理器中的 public_html 文件夹。 (确保您上传的是构建文件夹中的内容,而不是构建文件夹本身)。 Here is a link to a short tutorial
我正在尝试使用 cPanel 向 GoDaddy 启动 React 应用程序 (create-react-app),但在创建正确的构建时遇到问题。我在 package.json 中的“名称”和“版本”下方设置主页(不确定此处的顺序是否重要),如下所示:
"homepage": "http://mydomainname.org"
但是,当我 运行 npm run build
时,我收到一条消息说 "The project was built assuming it is hosted at /. You can control this with the homepage field in your package.json.
有没有人遇到过这个问题?
该消息不是错误。在你 运行 npm run build
命令之后,一个名为 build 的文件夹应该出现,它包含你的 React 应用程序。您需要将该文件夹的内容上传到 cpanel 文件管理器中的 public_html 文件夹。 (确保您上传的是构建文件夹中的内容,而不是构建文件夹本身)。 Here is a link to a short tutorial