Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
319 stars 53 forks source link

Failed github actions CI/CD deployment to azure #649

Open cognagano opened 2 years ago

cognagano commented 2 years ago

Describe the bug

It works in local environment. Error in actions CI/CD deployment

I watch this. but I couldn't avoid the error. https://github.com/Azure/static-web-apps/issues/531

Detecting platforms...
Detected following platforms:
  nodejs: 14.17.6
Version '14.17.6' of platform 'nodejs' is not installed. Generating script to install it...
Error: Could not find either 'build' or 'build:azure' node under 'scripts' in package.json. Could not find value for custom run build command using the environment variable key 'RUN_BUILD_COMMAND'.Could not find tools for building monorepos, no 'lerna.json' or 'lage.config.js' files found.

---End of Oryx build logs---
Oryx could not find a 'build' or 'build:azure' script in the package configuration. Please add one of these commands to your package configuration file (i.e. package.json). Alternatively, you can add the app_build_command to the build/deploy section of your workflow file. For example, app_build_command: 'npm run docs:build'

package.json

{
  "name": "xxxxxxx",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.18.2",
    "cookie-parser": "~1.4.3",
    "debug": "~2.6.9",
    "duplexpair": "^1.0.1",
    "ejs": "~2.5.7",
    "express": "^4.17.1",
    "morgan": "~1.9.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "^3.4.4",
    "serve-favicon": "~2.4.5",
    "tedious": "14.0.0"
  }
}

To Reproduce Steps to reproduce the behavior:

  1. It works in local environment.
  2. push to github
  3. auto start actions CI/CD deployment
  4. Build and Deploy Job Error
anthonychu commented 2 years ago

Looks like this might be an Express app. Static Web Apps supports hosting your React app directly without the need for a server like Express. If you’d like to use Express, Azure App Service may be a better option.

cognagano commented 2 years ago

@anthonychu Thanks for the reply. I'll consider it.

01willtx commented 1 year ago

@anthonychu I have a similar issue, same error, except I'm using blazor. I verified www has an index.html file (this was your recommendation for another similar issue.