![](/img/trans.png)
[英]How to deploy asp.net core 2.1 preview app to azure?? how do i install the new sdk in azure
[英]How do I successfully deploy a react app to Azure
我正在构建一个 React .NET 核心应用程序。 本地构建很好,但在 Azure 中,构建的 React/npm 部分失败。 以下:
> melanies_site@0.1.0 build D:\home\site\repository\ClientApp
remote: > react-scripts build
remote:
remote: 'react-scripts' is not recognized as an internal or external command,
remote: operable program or batch file.
remote:
remote: npm ERR! melanies_site@0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the melanies_site@0.1.0 build script.
remote: npm ERR! This is most likely a problem with the melanies_site package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR! react-scripts build
remote: npm ERR! You can get their info via:
remote: npm ERR! npm owner ls melanies_site
remote: npm ERR! There is likely additional logging output above.
remote: npm ERR! System Windows_NT 6.2.9200
remote: npm ERR! command "node" "D:\\Program Files (x86)\\npm\\1.4.28\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
remote: npm ERR! cwd D:\home\site\repository\ClientApp
remote: npm ERR! node -v v0.10.40
remote: npm ERR! npm -v 1.4.28
remote: npm ERR! code ELIFECYCLE
package.json:
{
"name": "melanies_site",
"version": "0.1.0",
"private": true,
"engines": {
"node": "10.15"
},
"dependencies": {
"bootstrap": "^3.4.1",
"react": "^16.0.0",
"react-bootstrap": "^0.31.5",
"react-dom": "^16.0.0",
"react-router-bootstrap": "^0.24.4",
"react-router-dom": "^4.2.2",
"react-scripts": "1.0.17",
"rimraf": "^2.6.2"
},
"scripts": {
"start": "rimraf ./build && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
我是反应开发的新手,也是使用 Azure 的新手。 我使用dotnet new react -o my-new-app
创建了这个应用程序
我尝试通过 npm 安装反应脚本。 也尝试添加
"engines": {
"node": "10.15"
},
到 package.json。
这是我要解决这样的问题:
使用最新版本更新我的所有依赖项(在 package.json 中保留 * 而不是版本)
删除你的package-lock.json
尝试运行 npm 从管理员安装 model
尝试运行 npm 审计修复
删除 Npm 和 npm-cache 文件夹
附加参考:请看下面的线程:
https://github.com/facebook/create-react-app/issues/1627
看看它是否有效。
我能够将我的应用程序部署到 Azure。
当我发布这个问题时,我试图使用 Kudu 进行部署(持续集成)。 我仍然没有找到以这种方式部署的解决方案。
现在,我在根目录中运行以下终端/控制台命令:
dotnet publish -c Release -o ./publish
然后我使用我的 FTP 客户端从 /publish 部署文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.