我正在尝试将 create-react-app 部署到 GitHub Pages,但我收到了 404。
404
这里没有 GitHub Pages 站点。
我所做的:
<username>.github.io"homepage": "https://<username>.github.io"到package.json(根据 Create React App 文档)gh-pages包"deploy": "gh-pages -b master -d build",以scripts在package.json/build文件夹的内容已成功推送到 master,但该站点无法访问。
repo 的 GitHub Pages 设置简单地说:
您的 GitHub Pages 站点当前正在从 master 分支构建。
用户页面必须从主分支构建。
我还尝试了一些路由解决方案(this和this),但没有任何区别,尽管我认为它们无法解决我遇到的问题。
我不确定如何进一步解决此问题。有任何想法吗?
我正在测试 React 的错误边界,并在 Codecov 中注意到我的 Sentry 函数的特定部分尚未经过测试。
我曾尝试使用 jest.mock("@sentry/browser") 并嘲笑 Sentry,但是,似乎无法测试这些行。Sentry 导入正确模拟但不是scope.
这是我尝试嘲笑的一个例子。
import * as Sentry from "@sentry/browser"
const mock_scope = jest.fn(() => {
return { setExtras: null }
})
Sentry.withScope = jest.fn().mockImplementation(mock_scope)
Run Code Online (Sandbox Code Playgroud) 我正在使用create-react-app工具来开发 React 应用程序。问题是,当我使用“npm start”命令运行应用程序时,它会在 Firefox 浏览器中打开,我希望它默认在 Chrome 浏览器中打开。
我发现许多答案提供了相同的解决方案,即在 package.json 文件中的脚本部分修改“开始”,但我用不同的代码一遍又一遍地尝试,但没有奏效。我不知道为什么我阅读的所有答案都没有解决我的问题。我在 Windows 7 中工作。
这是我的 package.json 代码:
{
"name": "jsx",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1"
},
"scripts": {
"start": "cross-env PORT=8080 BROWSER='Chrome' react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last …Run Code Online (Sandbox Code Playgroud) 1) 我在 Create-react-app 的帮助下创建了一个应用程序
2)它没有弹出
3)我不想公开上传源地图
4) 我已经设置了应用程序来使用 Rollbar.js 来跟踪生产中的错误
5) 手动上传不是一种选择,因为我将 js 分成块,其中大约有 20 个
但是我需要直接将源映射上传到 Rollbar(或者将它们托管在其他服务器上,这不适合我)
我已经阅读了Rollbar 文档。我还看过 webpack插件,它很难在不弹出的情况下使用。
Rollbar 文档显示了如何使用 curl 命令上传,但如果您以前从未使用过 shell 脚本,这将非常困难。
我尝试了几种不同的方法来设置这个项目,但每一种都失败了。这是我的问题。
这是我的 startup.cs 代码:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddNewtonsoftJson();
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "client/build";
});
}
// This method gets called by the …Run Code Online (Sandbox Code Playgroud) 我尝试在 CRA 3.x 上自定义 webpack 配置而不弹出。我想在外部目录上自定义构建输出。我看到的独特解决方案是使用重新连接的插件反应应用程序,但它似乎只适用于 CRA < 2。是否有另一种方法可以在不弹出我的 CRA 的情况下实现这一点?
每当我使用 create-react-app buildpack 部署我的 heroku 应用程序时,我第一次尝试访问我的域时,加载的页面是白色的,并且开发人员控制台中出现错误
Uncaught SyntaxError: Unexpected token <
Run Code Online (Sandbox Code Playgroud)
在main.6396d38a.js:1由反应构建生成的文件中。但是,当我刷新页面时,该网站运行良好。有没有可能发生这种情况?我试图在我的localhostusing上复制错误npm run build,serve -s build但我的网站在那里工作得很好。为什么每次反应部署到heroku后这只会出现一次?
我的 package.json 有一个与我网站的域名相关联的主页(不是 .herokuapp.com)
"homepage": "https://www.example.com/"
我正在运行npm uninstall create-react-app,它返回
npm WARN saveError ENOENT: no such file or directory, open '/Users/me/Documents/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/me/Documents/package.json'
npm WARN Documents No description
npm WARN Documents No repository field.
npm WARN Documents No README data
npm WARN Documents No license field.
Run Code Online (Sandbox Code Playgroud)
我想更新我的 create-react-app 版本,显然他们不再支持全局安装。当我第一次(不久前)安装 CRA 时,它是全局安装的。现在,我正在尝试更新它,但遇到了问题。我跑了npm update create-react-app,但是我的终端只闪烁一秒钟并返回到提示。因此,我决定create-react-app完全卸载并重新安装它,但是现在我遇到了上述警告/问题。
对可能发生的事情有什么想法吗?
编辑:
当我运行时npm i create-react-app,它也会抛出上面的WARNs,但它也说
+ create-react-app@3.3.0 // <---
added 1 package and audited 578 …Run Code Online (Sandbox Code Playgroud) 几个月来一直工作正常,两天前就辞职了。不记得在.yamls.
基本上,当我启动时create-react-app,create-react-app客户端只是启动、失败并重新启动。
我试过了:
skaffoldminikubekubectl这似乎是一个问题与skaffold及create-react-app为下依然能正常工作:
api和postgres豆荚仍然启动和运行完全正常create-react-app问题:cd client
npm install
npm start
Run Code Online (Sandbox Code Playgroud)
docker问题:cd client
docker build -f Dockerfile.dev .
docker run -it -p 3000:3000 <image_id>
Run Code Online (Sandbox Code Playgroud)
这是我的配置:
# client.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: client-deployment-dev
spec:
replicas: 1
selector: …Run Code Online (Sandbox Code Playgroud) I have created a react app using create-react-app and an express server using express-generator. My react app is running on http://localhost:3000 and my express server is running on http://localhost:8080. In my component I am making a POST fetch request to my express server, which is successfully running my express router code, returning a 200 response status code. However, the client console logs the following error and does not receive the response:
Proxy error: Could not proxy request /components/findAlbumArt from …Run Code Online (Sandbox Code Playgroud) create-react-app ×10
reactjs ×8
docker ×1
express ×1
fetch-api ×1
github ×1
github-pages ×1
heroku ×1
jestjs ×1
kubernetes ×1
node.js ×1
rollbar ×1
sentry ×1
skaffold ×1
typescript ×1
webpack ×1