如何修复azure部署错误:deployer = ms-azuretools-vscode部署路径

问题描述 投票:0回答:1

我将通过 vscode 部署 React 应用程序。 我点击了 vscode 左侧的“部署到 Web 应用程序”和构建文件夹 这是日志

5:01:32 PM  ...: Starting deployment...
5:01:32 PM  ...: Creating zip package...
5:01:32 PM  ...: Ignoring files from "appService.zipIgnorePattern"

5:01:35 PM  ...: Zip package size: 1.13 MB
5:02:39 PM  ...: Updating submodules.
5:02:40 PM  ...: Preparing deployment for commit id 'cad75485-9'.
5:02:41 PM  ...: PreDeployment: context.CleanOutputPath False
5:02:41 PM  ...: PreDeployment: context.OutputPath /home/site/wwwroot
5:02:41 PM  ...: Repository path is /tmp/zipdeploy/extracted
5:02:41 PM  ...: Running oryx build...
5:02:41 PM  ...: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 18 -p virtualenv_name= --log-file /tmp/build-debug.log  -i /tmp/8dc30e67918615e -p compress_node_modules=tar-gz | tee /tmp/oryx-build.log

5:02:42 PM  ...: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
5:02:42 PM  ...: You can report issues at https://github.com/Microsoft/Oryx/issues
5:02:42 PM  ...: Oryx Version: 0.2.20230508.1, Commit: 7fe2bf39b357dd68572b438a85ca50b5ecfb4592, ReleaseTagName: 20230508.1
5:02:42 PM  ...: Build Operation ID: 28fd5fa4b3e873ef

5:02:42 PM  ...: Repository Commit : cad75485-9378-4882-bd22-0dfb357bf052
5:02:42 PM  ...: OS Type           : bullseye
5:02:42 PM  ...: Image Type        : githubactions
5:02:42 PM  ...: Detecting platforms...
5:02:42 PM  ...: Could not detect any platform in the source directory.
5:02:43 PM  ...: Error: Couldn't detect a version for the platform 'nodejs' in the repo.
5:02:43 PM  ...: /bin/bash -c "oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 18 -p virtualenv_name= --log-file /tmp/build-debug.log  -i /tmp/8dc30e67918615e -p compress_node_modules=tar-gz | tee /tmp/oryx-build.log ; exit $PIPESTATUS "
5:02:43 PM  ...: Generating summary of Oryx build
5:02:43 PM  ...: Parsing the build logs
5:02:44 PM  ...: Found 0 issue(s)
5:02:44 PM  ...: Build Summary :
5:02:44 PM  ...: ===============
5:02:44 PM  ...: Errors (0)
5:02:44 PM  ...: Warnings (0)
5:02:45 PM  ...: Deployment Failed. deployer = ms-azuretools-vscode deploymentPath = ZipDeploy. Extract zip. Remote build.
5:03:22 PM  ...: Deployment failed

.

请帮助我。

我的azure配置是这样的:

azure azure-web-app-service webdeploy
1个回答
0
投票

错误:无法在存储库中检测到平台“nodejs”的版本。

上述错误表明存储库中未指定节点版本。 检查package.json和package-lock.json中的节点配置。检查下面:

package.json:

{
  "name": "my-react-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.17.0",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "engines": {
    "node": "14.x"
  }
}

更新部署过程中使用的 Oryx 版本。新版本可能修复了错误或改进了兼容性。

我使用以下命令创建了示例反应应用程序。

npm install -g create-react-app
npx create-react-app my-react-app
cd my-react-app
npm start

使用

npm start
命令成功运行 React 应用程序。

enter image description here enter image description here

通过运行

npm run build
命令,将在项目目录中创建构建文件夹。

我选择了React应用程序的唯一构建文件夹,然后成功部署到azure Web应用程序服务中。检查下面:

enter image description here

我的应用程序部署工作流程如下:

10:42:24 AM hireact: Starting deployment...
10:42:24 AM hireact: Creating zip package...
10:42:26 AM hireact: Zip package size: 188 kB
10:42:27 AM hireact: Updating submodules.
10:42:27 AM hireact: Preparing deployment for commit id '28efa3aeb7'.
10:42:28 AM hireact: Generating deployment script.
10:42:28 AM hireact: Using the following command to generate deployment script: 'azure site deploymentscript -y --no-dot-deployment -r "C:\local\Temp\zipdeploy\extracted" -o "C:\home\site\deployments\tools" --basic --sitePath "C:\local\Temp\zipdeploy\extracted"'.
10:42:29 AM hireact: AppInsightsAgent: Successfully loaded ETW
10:42:32 AM hireact: AppInsightsAgent ETWLogger Application Insights was started succesfully.
10:42:32 AM hireact: Generating deployment script for Web Site
10:42:32 AM hireact: Generated deployment script files
10:42:33 AM hireact: Running deployment command...
10:42:33 AM hireact: Command: "C:\home\site\deployments\tools\deploy.cmd"
10:42:33 AM hireact: Handling Basic Web Site deployment.
10:42:34 AM hireact: Creating app_offline.htm
10:42:34 AM hireact: KuduSync.NET from: 'C:\local\Temp\zipdeploy\extracted' to: 'C:\home\site\wwwroot'
10:42:34 AM hireact: Deleting file: 'hostingstart.html'
10:42:34 AM hireact: Copying file: 'asset-manifest.json'
10:42:34 AM hireact: Copying file: 'favicon.ico'
10:42:34 AM hireact: Copying file: 'index.html'
10:42:34 AM hireact: Copying file: 'logo192.png'
10:42:34 AM hireact: Copying file: 'logo512.png'
10:42:34 AM hireact: Copying file: 'manifest.json'
10:42:34 AM hireact: Copying file: 'robots.txt'
10:42:34 AM hireact: Copying file: 'static\css\main.f855e6bc.css'
10:42:34 AM hireact: Copying file: 'static\css\main.f855e6bc.css.map'
10:42:35 AM hireact: Copying file: 'static\js\453.ad6eb26e.chunk.js'
10:42:35 AM hireact: Copying file: 'static\js\453.ad6eb26e.chunk.js.map'
10:42:35 AM hireact: Copying file: 'static\js\main.1130187e.js'
10:42:35 AM hireact: Copying file: 'static\js\main.1130187e.js.LICENSE.txt'
10:42:35 AM hireact: Copying file: 'static\js\main.1130187e.js.map'
10:42:35 AM hireact: Copying file: 'static\media\logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg'
10:42:35 AM hireact: Deleting app_offline.htm
10:42:35 AM hireact: Finished successfully.
10:42:40 AM: Deployment to "hireact" completed.

enter image description here

输出:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.