部署create-react-app时无法加载资源错误404

帕特里克

任何帮助将不胜感激。谢谢!

我可以在本地正常运行我的网站,但是在生产环境中部署它时会遇到问题。当我运行时npm run deploy,它应该会自动构建到生产环境中。

在此处输入图片说明

这是我package.json的deploy命令的一部分

{
    "name": "barrex",
    "version": "0.1.0",
    "homepage": "https://patrickhuang94.github.io/barrex",
    "devDependencies": {
        "gh-pages": "^0.12.0",
        "react-scripts": "0.9.5"
    },
    "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",    
        "deploy": "npm run build&&gh-pages -d build"
    }
}

我的所有内容均已gh-pages正确设置。当我运行在“首页”字段(Barrex)中指定的URL时,它将重定向到我的自定义域。但是我的自定义域找不到应该使用创建的.js文件npm run deploy有人可以解释为什么它可以在本地计算机上正常运行,却找不到生产资源吗?

还有阿布拉莫夫

就像在屏幕截图中说的那样,该项目是在假设托管于的情况下构建的/barrex/
但是,您是从服务器根目录提供它的。

更改homepagepackage.json您的自定义域(http://www.barrexus.com/)。下次构建时,它将推断/路径项目是在其上托管的,并改为使用它。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

部署create-react-app

在Nginx上部署Create-React-App

Heroku 部署错误 - 带有 Create-React-App 的节点

无法在Github Pages上部署新的create-react-app

无法使用令牌部署 create-react-app

Create-React-App:在本地计算机上部署时出现ESlint错误

在Google App Engine上部署create-react-app

部署create-react-app-静态还是动态?

使用create-react-app在azure上进行部署

使用Azure管道部署create-react-app

使用create-react-app的Heroku部署问题

使用create-react-app部署github页面时的React-router问题

当页面返回 404 时,如何将带有打字稿的 create-react-app 部署到 Netlify

获取404以获取与部署到github页面的create-react-app的链接

在 Heroku 上部署 create-react-app 的应用程序错误

如何将React应用(create-react-app)部署到Back4App?

使用gh-pages在github上部署create-react-app时出现问题

将Create React App部署到Netlify时没有源映射

通过nginx部署create-react-app构建文件夹时页面为空?

部署到Heroku时如何在没有create-react-app的React应用中设置代理

404无法加载资源将Flutter Web App部署到GitHub Pages

在Github中部署React页面-加载资源失败:服务器响应状态为404

在 OpenShift 上部署 Create React App:EACCES:权限被拒绝,打开“/home/node/app/.eslintcache”

create-react-app构建部署在LAMP / XAMPP / WAMP上

如何使用自定义后端API将'create-react-app'部署到Heroku

Heroku create-react-app部署未捕获的SyntaxError:意外的令牌<

如何在AWS EC2中部署create-react-app

如何将create-react-app部署到Google Cloud

Localhost与已部署之间的基本URL差异-create-react-app