简体   繁体   English

在 Azure 应用服务部署上安装 npm package 时出错

[英]Error installing npm package on Azure app service deploy

I'm trying to deploy my reactjs project on Azure app service but when I started the deploy I get the follow log error on npm install part and the deploy failed我正在尝试将我的 reactjs 项目部署到 Azure 应用程序服务上,但是当我开始部署时,我在 npm 安装部分收到以下日志错误并且部署失败

My node version is 16.13.2我的节点版本是 16.13.2

I followed these steps:我遵循了以下步骤:

1- Run npm run build 1- 运行 npm 运行构建

2- Deploy to the main branch 2-部署到主分支

3- Deploy started automaticaly to Azure app service 3- 部署自动启动到 Azure 应用程序服务

4- Got the Erro: 4- 得到错误:

Updating iisnode.yml at C:\home\site\wwwroot\iisnode.yml
Invalid start-up command "react-scripts start" in package.json. Please use the format "node <script relative path>".
Missing server.js/app.js files, web.config is not generated
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm ERR! code 8
npm ERR! path C:\home\site\wwwroot\node_modules\@progress\kendo-licensing
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node ./bin/kendo-ui-license.js activate --ignore-no-license
npm ERR! C:\home\site\wwwroot\node_modules\@progress\kendo-licensing\bin\kendo-ui-license.js:2
npm ERR! amespace[_0x4d18('0x4c')](licenseFile,fs__namespace[_0x4d18('0x11')][_0x4d18('
npm ERR!                                                                     ^
npm ERR! TypeError: Cannot read property 'R_OK' of undefined
npm ERR!     at activateLicense (C:\home\site\wwwroot\node_modules\@progress\kendo-licensing\bin\kendo-ui-license.js:2:8834)
npm ERR!     at Object.<anonymous> (C:\home\site\wwwroot\node_modules\@progress\kendo-licensing\bin\kendo-ui-license.js:2:7890)
npm ERR!     at Module._compile (module.js:456:26)
npm ERR!     at Object.Module._extensions..js (module.js:474:10)
npm ERR!     at Module.load (module.js:356:32)
npm ERR!     at Function.Module._load (module.js:312:12)
npm ERR!     at Function.Module.runMain (module.js:497:10)
Failed exitCode=8, command="C:\Program Files (x86)\nodejs\16.13.0\node.exe" "C:\Program Files (x86)\npm\8.1.0\node_modules\npm\bin\npm-cli.js" install --production
npm ERR!     at startup (node.js:119:16)
An error has occurred during web site deployment.
npm ERR!     at node.js:935:3

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\local\LocalAppData\npm-cache\_logs\2022-03-05T13_14_13_352Z-debug.log
Invalid start-up command "react-scripts start" in package.json. Please use the format "node <script relative path>".\r\nMissing server.js/app.js files, web.config is not generated\r\nnpm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated\r\nnpm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated\r\nnpm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated\r\nnpm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies\r\nnpm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated\r\nnpm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated\r\nnpm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.\r\nnpm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.\r\nnpm ERR! code 8\r\nnpm ERR! path C:\home\site\wwwroot\node_modules\@progress\kendo-licensing\r\nnpm ERR! command failed\r\nnpm ERR! command C:\Windows\system32\cmd.exe /d /s /c node ./bin/kendo-ui-license.js activate --ignore-no-license\r\nnpm ERR! C:\home\site\wwwroot\node_modules\@progress\kendo-licensing\bin\kendo-ui-license.js:2\r\nnpm ERR! amespace[_0x4d18('0x4c')](licenseFile,fs__namespace[_0x4d18('0x11')][_0x4d18('\r\nnpm ERR!                                                                     ^\r\nnpm ERR! TypeError: Cannot read property 'R_OK' of undefined\r\nnpm ERR!     at activateLicense (C:\home\site\wwwroot\node_modules\@progress\kendo-licensing\bin\kendo-ui-license.js:2:8834)\r\nnpm ERR!     at Object.<anonymous> (C:\home\site\wwwroot\node_modules\@progress\kendo-licensing\bin\kendo-ui-license.js:2:7890)\r\nnpm ERR!     at Module._compile (module.js:456:26)\r\nnpm ERR!     at Object.Module._extensions..js (module.js:474:10)\r\nnpm ERR!     at Module.load (module.js:356:32)\r\nnpm ERR!     at Function.Module._load (module.js:312:12)\r\nnpm ERR!     at Function.Module.runMain (module.js:497:10)\r\nnpm ERR!     at startup (node.js:119:16)\r\nnpm ERR!     at node.js:935:3\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR!     C:\local\LocalAppData\npm-cache\_logs\2022-03-05T13_14_13_352Z-debug.log\r\nC:\Program Files (x86)\SiteExtensions\Kudu\96.40113.5578\bin\Scripts\starter.cmd "C:\home\site\deployments\tools\deploy.cmd"

Here is my package.json:这是我的 package.json:

{
  "name": "",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@progress/kendo-data-query": "^1.5.5",
    "@progress/kendo-drawing": "^1.16.2",
    "@progress/kendo-licensing": "^1.2.2",
    "@progress/kendo-react-animation": "^5.0.1",
    "@progress/kendo-react-data-tools": "^5.0.1",
    "@progress/kendo-react-dateinputs": "^5.0.1",
    "@progress/kendo-react-dropdowns": "^5.0.1",
    "@progress/kendo-react-grid": "^5.0.1",
    "@progress/kendo-react-inputs": "^5.0.1",
    "@progress/kendo-react-intl": "^5.0.1",
    "@progress/kendo-react-treeview": "^5.0.1",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^12.0.0",
    "@testing-library/user-event": "^13.2.1",
    "@types/jest": "^27.0.1",
    "@types/node": "^16.7.13",
    "@types/react-dom": "^17.0.9",
    "axios": "^0.25.0",
    "miragejs": "^0.1.43",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-icons": "^4.3.1",
    "react-input-mask": "^2.0.4",
    "react-router-dom": "^6.2.1",
    "react-scripts": "5.0.0",
    "styled-components": "^5.3.3",
    "typescript": "^4.4.2",
    "web-vitals": "^2.1.0",
    "webpack-cli": "3.1.1"
  },
  "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"
    ]
  },
  "devDependencies": {
    "@types/react": "^17.0.39",
    "@types/styled-components": "^5.1.19",
    "@types/uuid": "^8.3.4"
  },
  "engines": {
    "node": ">8.0.0"
  }
}

As the error stating that, web.config file is not generated.如错误所述,未生成web.config文件。

So, Create web.config file if you don't have and Put it in /public.因此,如果没有,请创建web.config文件并将其放入 /public。

During the build, it is copied over to dist folder.在构建期间,它被复制到dist文件夹。

Here is workaround I tried to create the web.config file.这是我尝试创建web.config文件的解决方法。

在此处输入图像描述

Web.config file is copied to dist folder after running npm run build command.运行npm run build命令后, Web.config文件被复制到dist文件夹。

After publishing, check in the Azure Portal > Web App > Advanced Tools > Kudu - Debug Console (CMD) > Site - wwwroot, check if web.config file exists.发布后进入Azure传送门 > Web App > Advanced Tools > Kudu - Debug Console (CMD) > Site - wwwroot,查看web.config文件是否存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure Devops 管道返回:'无法将 web package 部署到应用服务。 内部服务器错误(代码:500)' - Azure Devops Pipeline returning: 'Failed to deploy web package to App Service. Internal Server Error (CODE: 500)' 部署Azure function到微软Azure中的应用服务 - Deploy Azure function to app service in Microsoft Azure 如何从github部署到Azure应用服务 - How to Deploy from github to Azure App Service 部署 Azure 应用服务时出错:ERROR_COULD_NOT_CONNECT_TO_REMOTESVC - Error while Deploy Azure App Service : ERROR_COULD_NOT_CONNECT_TO_REMOTESVC 错误 GitHub 操作部署到 Azure Web 应用程序 - Error with GitHub Action Deploy to Azure Web App 如何使用 cdktf 的 Azure Container Registry 部署 App Service - How to deploy App Service with Azure Container Registry by cdktf Angular 应用程序在 Azure 部署后显示错误 - Angular app shows error after Azure deploy 如何在没有公共端点的 azure 和 Laravel 8 和 PHP 8 中部署应用服务? - How to Deploy an App Service in azure with Laravel 8 and PHP 8 without public endpoint? 从 npm 私人仓库在 gitlabci 中安装 npm package - installing a npm package in gitlabci from npm private repo 使用哪些 azure 服务(AKS 或 App 服务)在 azure 上部署多个 docker 容器(启用组合) - Which azure services to use ( AKS or App service) to deploy multiple docker containers (compose enabled) on azure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM