将 Express 部署到 azure 应用程序服务本地 git 时遇到问题,链接依赖项时失败

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

尝试使用本地 git 将express.js应用程序部署到azure应用程序服务。该应用程序在我的本地运行良好,但在链接依赖项时失败。它在端口 80 上运行。我在没有 node_modules 的情况下进行部署。 public文件夹内有react的build。

2024-06-08T19:51:30.752150035Z   /  _  \ __________ _________   ____  
2024-06-08T19:51:30.752154235Z  /  /_\  \\___   /  |  \_  __ \_/ __ \ 
2024-06-08T19:51:30.752157335Z /    |    \/    /|  |  /|  | \/\  ___/ 
2024-06-08T19:51:30.752160335Z \____|__  /_____ \____/ |__|    \___  >
2024-06-08T19:51:30.752163435Z         \/      \/                  \/ 
2024-06-08T19:51:30.752166335Z A P P   S E R V I C E   O N   L I N U X
2024-06-08T19:51:30.752169535Z 
2024-06-08T19:51:30.752172235Z Documentation: http://aka.ms/webapp-linux
2024-06-08T19:51:30.752175535Z NodeJS quickstart: https://aka.ms/node-qs
2024-06-08T19:51:30.752178335Z NodeJS Version : v18.19.1
2024-06-08T19:51:30.752181035Z Note: Any data outside '/home' is not persisted
2024-06-08T19:51:30.752184035Z 
2024-06-08T19:51:31.193914248Z Starting OpenBSD Secure Shell server: sshd.
2024-06-08T19:51:31.244489951Z Starting periodic command scheduler: cron.
2024-06-08T19:51:31.276188603Z Could not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2024-06-08T19:51:31.280345636Z Could not find operation ID in manifest. Generating an operation id...
2024-06-08T19:51:31.280378236Z Build Operation ID: 41e9c42e-d2f1-434c-a412-46c9c404420a
2024-06-08T19:51:31.485113164Z Environment Variables for Application Insight's IPA Codeless Configuration exists..
2024-06-08T19:51:31.507160140Z Writing output script to '/opt/startup/startup.sh'
2024-06-08T19:51:31.544600937Z Running #!/bin/sh
2024-06-08T19:51:31.544629338Z 
2024-06-08T19:51:31.544633938Z # Enter the source directory to make sure the script runs where the user expects
2024-06-08T19:51:31.544637538Z cd "/home/site/wwwroot"
2024-06-08T19:51:31.544640938Z 
2024-06-08T19:51:31.544644138Z export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH
2024-06-08T19:51:31.544647438Z if [ -z "$PORT" ]; then
2024-06-08T19:51:31.544650738Z      export PORT=8080
2024-06-08T19:51:31.544654538Z fi
2024-06-08T19:51:31.544657638Z 
2024-06-08T19:51:31.544660738Z PATH="$PATH:/home/site/wwwroot" cd prodoslo1 && yarn install && yarn run prod
2024-06-08T19:51:31.955441605Z yarn install v1.22.15
2024-06-08T19:51:32.085875742Z [1/5] Validating package.json...
2024-06-08T19:51:32.089607272Z [2/5] Resolving packages...
2024-06-08T19:51:32.662441527Z [3/5] Fetching packages...
2024-06-08T19:51:52.373047412Z info [email protected]: The platform "linux" is incompatible with this module.
2024-06-08T19:51:52.373369015Z info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
2024-06-08T19:51:52.395040552Z [4/5] Linking dependencies...
2024-06-08T19:51:53.245750111Z error Could not write file "/home/site/wwwroot/prodoslo1/yarn-error.log": "EROFS: read-only file system, open '/home/site/wwwroot/prodoslo1/yarn-error.log'"
2024-06-08T19:51:53.246134615Z error An unexpected error occurred: "EROFS: read-only file system, mkdir '/home/site/wwwroot/prodoslo1/node_modules'".
2024-06-08T19:51:53.246313917Z info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

package.json


"dependencies": {
    "@babel/cli": "^7.18.10",
    "@babel/core": "^7.18.13",
    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
    "@babel/polyfill": "^7.12.1",
    "@babel/preset-env": "^7.18.10",
    "@babel/register": "^7.18.9",
    "@sentry/node": "^7.58.1",
    "axios": "^1.3.5",
    "babel-plugin-dynamic-import-node-babel-7": "^2.0.7",
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.20.0",
    "cookie-parser": "^1.4.6",
    "cors": "^2.8.5",
    "date-fns": "^2.30.0",
    "debug": "^4.3.4",
    "dotenv": "^16.0.1",
    "exceljs": "^4.3.0",
    "express": "^4.18.1",
    "google-auth-library": "^8.9.0",
    "google-spreadsheet": "^4.0.2",
    "googleapis": "^120.0.0",
    "jsonwebtoken": "^8.5.1",
    "lodash": "^4.17.21",
    "mathjs": "^11.11.1",
    "moment": "^2.29.4",
    "morgan": "^1.10.0",
    "multer": "^1.4.5-lts.1",
    "mysql2": "^2.3.3",
    "node-cron": "^3.0.2",
    "nodemailer": "^6.9.1",
    "nodemon": "^2.0.19",
    "npm-run-all": "^4.1.5",
    "query-string": "^8.1.0",
    "rimraf": "^5.0.0",
    "sequelize": "^6.37.1",
    "socket.io": "^4.7.2",
    "swagger-autogen": "^2.23.7",
    "swagger-ui-express": "^5.0.0",
    "sweetalert2": "^11.6.10",
    "twilio": "^4.19.3",
    "uuid": "^9.0.0",
    "ws": "^8.15.1",
    "xlsx": "https://cdn.sheetjs.com/xlsx-0.19.1/xlsx-0.19.1.tgz"
  },
  "lint-staged": {
    "*.{js}": [
      "yarn run format",
      "git add ."
    ]
  },
  "devDependencies": {
    "@babel/plugin-syntax-import-assertions": "^7.22.5",
    "@babel/plugin-transform-modules-commonjs": "^7.22.5",
    "eslint": "8.22.0",
    "eslint-config-google": "^0.14.0",
    "husky": "^8.0.1",
    "jest": "^28.1.3",
    "lint-staged": "^13.0.3",
    "prettier": "^2.7.1"
  },
  "jest": {
    "testEnvironment": "node"
  }

不知道该怎么办。我希望有一个错误能告诉我出了什么问题。

node.js azure express
1个回答
0
投票

fsevents是一个原生的macOS库,意思是文件系统事件。它通常由文件观察程序或任何监视文件系统更改或其他活动的代码使用。适用于 Linux 的 Azure 应用服务在 Ubuntu 上运行,因此无法使用该库。

它似乎是一种间接依赖,可能源于对 nodemon 的引用。

您可以使用以下任一方法检查项目目录中依赖项的来源:

npm ls fsevents

...或者...

yarn why fsevents

然后您需要进行适当的调整,以便不使用该库。

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