gpt4 book ai didi

reactjs - Azure 静态 Web 应用上的 React 的构建配置是什么?

转载 作者:行者123 更新时间:2023-12-03 01:18:39 28 4
gpt4 key购买 nike

我似乎已经尝试了所有方法,并且看到了关于将 React 应用程序(没有 API)部署到 Azure 静态 Web 应用程序的相互冲突的说明,甚至来自 Microsoft。有人成功做到过吗?

我使用的最新文档是: https://learn.microsoft.com/en-gb/azure/static-web-apps/get-started-portal?tabs=react&pivots=github

它用于在门户中创建 SWA,尽管我也使用过其他的但存在问题。

我现在遇到了这个错误:


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9bebfee9f8fef5effafcfeb6f8faf7f8eef7faeff4e9dbabb5aab5ab" rel="noreferrer noopener nofollow">[email protected]</a> build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d0a0b5a2b3b5bea4b1b7b5fdb3b1bcb3a5bcb1a4bfa290e0fee1fee0" rel="noreferrer noopener nofollow">[email protected]</a> build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /github/home/.npm/_logs/2022-07-12T19_38_33_349Z-debug.log
---End of Oryx build logs---

Oryx has failed to build the solution.

如果重要的话,这是我的文件结构:

react-app ->src ->components ->index.js,App.js etc..
->public ->index.html etc..
->build (build is gitignored)
->node_modules etc..

我的 azurestaticwebapps...yml 文件包含:

app_location: "/"
api_location: ""
output_location: "build"

https://github.com/markhardy/percentage-calculator/runs/7308960687?check_suite_focus=true

有人可以解释一下我做错了什么吗?我现在很茫然,特别是对于 Microsoft 的相互冲突的指示。

最佳答案

您的代码中似乎有警告,因此编译器不喜欢它。只需更改 yml 文件如下:

在 build_and_deploy_job 下,添加:环境:CI:假

这将停止将警告视为错误。

关于reactjs - Azure 静态 Web 应用上的 React 的构建配置是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72957771/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com