Home
Support Forums

Uploading problem to Netlify

Hi I have this problem with npm run build that I shared on stackoverflow (reactjs - I have a problem with react and npm run build - Stack Overflow)
I think this is the cause that I cannot successfully publish a deploy with the files I have, is there a solution to this that lets me upload my new files

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile:

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!

1 Like

this is the error code that my gitbash shows

$ npm run build

> express@3.2.2 build
> cross-env GENERATE_SOURCEMAP=false react-scripts build

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

Cannot read property 'includes' of undefined

and this is the build line of code I have on my scripts

"build": "cross-env GENERATE_SOURCEMAP=false react-scripts build",

Hi @Ulrik7000

Unfortunately this error message does not provide a lot of details. Can you provide the link to your deploy log (if public)?
Are you able to share your git repository?

As for alternatives, you can build your site locally and upload the build directory to Netlify instead of having Netlify do the building. You can do this using Drag and Drop or synchronise your build directory to your git repository (rather than your project source files) and have it deploy from there (without configuring a build command, etc.)

Hi @coelmay ths is the link to my deploys Netlify App
My web-app is to heavy to share with github so every deploy I have done is using the build folder, but this time gtibash isnt lettting me

Thanks @Ulrik7000 but unfortunately your deploy log is not publicly viewable.

Oh I see, could you tell me how to make it public? I’d really appreciate that

Under Site Settings > Build & Deploy. You can only make logs public when a git repository is public.

Ok it might be this one now Netlify App

This log gives a very different error message

9:16:22 AM: Could not find a required file.
9:16:22 AM:   Name: index.js
9:16:22 AM:   Searched in: /opt/build/repo/src

Because there is no index.js file.

The error message I shared before wasn’t from a deploy log, it was from my local production command line gitbash, I can run my project on local host as usual with npm start but when I try to make a build folder to upload on netlify, I can’t see it running

It is very difficult to assist with local build issues as your production environment is different to mine (I don’t use gitbash because I don’t use Windows so I cannot attempt to replicate this.)

Things don’t run on Netlify. You build a static site and then it is served to visitors from Netlify’s CDN.

As previously mentioned, if you are uploading a built site, nothing then needs building on Netlify:

2 Likes

Ok thanks how can I go back to Drag and Drop with this site? I had it set up that way at the beggining but now I have it synchronised to my git repository and I want it to stop synchronising

If you have Netlify CLI installed you can run the unlinkSiteRepo API command with it.

Alternatively, you can use cURL

curl -X PUT \
     -H "Authorization: Bearer <YOUR-API-KEY>" \
     -H 'User-Agent: <YOUR-NAME-EMAIL>' \
     https://api.netlify.com/api/v1/sites/<SITE-API-ID>/unlink_repo

or a Support Engineer can unlink it for if the above options are unavailable to you.