Static Web Apps Tutorial: Error from Git:Push operation - Installing nodejs

Rob Innes 25 Reputation points
2024-09-29T21:53:23.28+00:00

I'm walking through the tutorial "Add an API to Azure Static Web Apps with Azure Functions":

https://zcusa.951200.xyz/en-us/azure/static-web-apps/add-api?tabs=vanilla-javascript

I'm able to run the app locally but am getting an error at "Deploy Changes" (near the end), Step 5 pushing changes to Git.

The log from GitHub includes the following:

Detecting platforms... Detected following platforms: nodejs: 18.20.4 Version '18.20.4' 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.

My YAML file is updated per the tutorial to include the following:

          app_location: "/" # App source code path
          api_location: "api" # Api source code path - optional
          output_location: "build" # Built app content directory - optional 

This is package.json in its entirety:

{
  "name": "vanilla-basic",
  "version": "1.0.0",
  "scripts": { 
    "start": "sirv ./src public --cors --single --no-clear --port 8000"
  }
}

Please advise. Thanks!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,257 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,021 questions
{count} vote

Accepted answer
  1. VenkateshDodda-MSFT 23,151 Reputation points Microsoft Employee
    2024-09-30T08:36:26.43+00:00

    @Rob Innes Thanks for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.

    As mentioned earlier, we are also facing the same issue when we use the below values as in API location to our workflow.

    app_location: "/"
     api_location: "api"
     output_location: "build" 
    
    

    Could you please update the values of api_location, app_location,output_location in your .github/workflows/azure-static-web-apps-<DEFAULT-HOSTNAME>.yml.

    User's image

    Post making the above changes I am able to deploy & request the static webapp without any issues. Also, seems like document is outdated I have shared the feedback to internal team to make the above changes accordingly.

    Hope this helps, let me know if you have any further questions on this.

    Please accept as "Yes" if the answer is helpful so that it can help others in the community.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.