The action on Github is failing to construct a React application

Whenever I attempt to build my project on my computer using the command (npm run build "scripts": { "build": "react-scripts build --passWithNoTests" }), it successfully builds without any issues. However, when I push these changes to GitHub, the building process fails.

> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2844474f681806190618">[email protected]</a> build /home/runner/work/project/project
> react-scripts build --passWithNoTests

Creating an optimized production build...

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e28e8d85a2d2ccd3ccd2">[email protected]</a> build: `react-scripts build --passWithNoTests`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b9d5d6def98997889789">[email protected]</a> build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2020-08-17T06_51_55_527Z-debug.log
##[error]Process completed with exit code 1.

This issue seems to be related to the yml file included in the project.

name: Node.js CI
on:
  push:
    branches: [ test ]
  pull_request:
    branches: [ test ]

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
      
    - name: clean cache
      run: npm cache clean --force
    - name: install
      run: npm ci
    - name: npm install
      run: npm install
    - name: build
      run: npm run test --if-present

I am unsure how to resolve this issue. Can anyone provide guidance on how to fix this?

Answer №1

GitHub Actions automatically set the CI environment variable to true , which is causing warnings to be treated as errors. To resolve this, you can use the following code snippet.

- name: build
  run: npm run test --if-present
  env:
     CI: false

Enjoy the automated process!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

steps to initiate re-render of rating module

My first experience with React has been interesting. I decided to challenge myself by creating a 5-star rating component. All logs are showing up properly, but there seems to be an issue with the component not re-rendering when the state changes. Thank you ...

Retrieve information from multiple RSS feeds using Next.js

As a newcomer to Next.js, I decided to experiment with a newsfeed tool to get more acquainted with the framework. My goal was to retrieve data from a collection of RSS feeds, but I encountered some unexpected issues in the process. How should I proceed? B ...

Encountered an issue while resolving dependencies in Vercel: During the resolution process, it was identified that @material-ui/[email protected] was found, with an

Encountered this log while deploying on Vercel: Installing dependencies... npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @material-ui/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemai ...

The Material UI React radio buttons have the ability to modify the value of previous buttons

I'm facing an issue with my Material UI React Stepper Component that contains a group of radio buttons. The problem is that changing the radio button in one step affects the selected value in previous and future steps. I've experimented with diff ...

Retrieve the response time using the node.js request library

Exploring the capabilities of the nodejs request library: https://github.com/mikeal/request var request = require('request'); request('http://example.com', function (error, response, body) { ... }) Has anyone discovered a way to ex ...

What methods are available to modify the colors in an Apex bar chart?

Currently, I am in the process of constructing a bar chart using react, mui, and apex-chart. One specific requirement I have is to modify the colors of the bars displayed on the chart. Despite my efforts in attempting various solutions, I have been unsucce ...

Unable to successfully install protagonist using npm on macOS version 10.9.5

Having trouble installing the Protagonist in OS X using npm install protagonist. Unfortunately, it's failing with the following errors: Any suggestions on how to resolve this? $node -v v0.11.13 $npm -v 1.4.9 $npm install protagonist npm http GET ht ...

Can you explain the significance of the "null" area in the source-map-explorer visualization of my React project, and why does it appear to be disproportionately large compared to other areas?

Currently, I've been immersed in a React project that consists of 8 components and makes use of styled-components, react-spring, and AWS-Amplify. Despite the simplicity of the project, the build size is unexpectedly over 3MB. After analyzing it with ...

What is the best way to incorporate vertical scrolling into a React material table?

I'm having trouble getting vertical scroll to work with my material table in React Typescript. Horizontal scroll is functioning properly for large data, but I'm stuck on implementing the vertical scroll. Here's my code: {isLoading ? ...

Is there a method to display logs in Node JS without relying on process.stdout.write?

I am currently experimenting with piping two Node.js scripts together, and I have found that it works well when using the following method. How to pipe Node.js scripts together using Unix | pipe (on the command line)? For example: $ ./script1.js | ./scr ...

The inner joins in my SQL query are causing me to receive duplicate results

I am trying to retrieve the posts made by users followed by the userID (? in the query), as well as the posts by the user themselves. SELECT posts.id AS postid, posts.user AS user, posts.images AS images, posts.post_created, posts.textvalue, posts.te ...

Exploring file writing using Node Webkit and JavaScript

When developing my app, I encountered an issue with the 'fs' module not functioning as expected. Despite the code being written to write a file, nothing happens when the app is launched. However, if I start the app using the following command: $ ...

Having trouble sending Props between components within a specific route as I keep receiving undefined values

Here is the code for the initial component where I am sending props: const DeveloperCard = ({dev}) => { return ( <Link to={{pathname:`/dev/${dev._id}`, devProps:{dev:dev}}}> <Button variant="primary">Learn More</Butt ...

I'm sorry, but your request to access the API from the React localhost has been hinder

Currently, I am delving into the world of React, a JavaScript framework. My task involves fetching a token from an API provided by this service: . To achieve this, I must include my X_CONSUMER_KEY in the request. Here is the approach I am taking using the ...

Using node.js to generate an object from a raw HTTP request string

I've got a raw HTTP request string that I need to convert into an object representation. Instead of trying to create something new, I was considering using the internal http parser to generate an instance of http.IncomingMessage Can it be done? I b ...

Browsing through a collection of JSON objects with a user interface

I need a way to filter and display a list of Dogs based on a search query. I initially stored the data in an array within the state, but with an increasing number of entries, I've decided to switch to JSON format for better management. However, I&apo ...

Combine the running of the app and the mocking of tests into a single Grunt command within the Gr

I currently have a fully functional Node.js Express REST API application. Great. In addition, I have successfully created a Mocha/Chai/Supertest mock to test the API application mentioned above. Excellent. However, the issue arises when I need to manuall ...

The JSON code encountered an unexpected token

My current setup involves using webpack with React to load external data from a static json file. Inside my entry.jsx file, I have the following code: const data = require('../data/data.json'); However, this code results in an error message: ...

No image is displayed when searching for a photo on Google Places

When calling the API to retrieve an image, instead of getting the actual image, I receive a link to an HTML page with the requested image. How do I get only the image itself? Here is the code snippet, where the "foto" parameter is the photo_reference obtai ...

When deploying to Netlify, event times set with moment.js appear 1 hour and 30 minutes ahead of the local time

My node.js script utilizes moment.js to generate timetables. It functions perfectly fine locally in Minsk, but once deployed on Netlify, every event is showing up 1:30 hours ahead of the local time. Any suggestions on how to troubleshoot and fix this iss ...