skip to Main Content

After completion of project ,i run npm run build but unable to build error showing .

npm run build

> [email protected] build
> react-scripts build

Creating an optimized production build...
Failed to compile.

Cannot read properties of undefined (reading 'includes')

i tried in my all codes but in codes no error is there.with includes.
i’m expecting to build my project completely by running npm run build.

2

Answers


  1. There might be a pretty good chance that the includes method you are using on a variable/function has initially not defined or not returning any value. That’s how it’s throwing the undefined. In such cases, You can use some sort of condition like if before calling the includes or you can declare some empty values to it initially.

    Login or Signup to reply.
  2. try to find out where you have used .includes inside project.
    and lets say you are using like this

    variable.includes
    

    instead of this, use

    variable?.includes
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search