Home
Support Forums

Failed to build site - Need Help Troubleshooting

I need advice to debug deploy Netlify App

Trying to deploy website built with Create React App… there’s a lot of warnings. The Docs told me to use CI=’’ before my npm run build but still doesn’t work. If anyone can help, much apppreciated.

Welcome to the forum @EndofLine4

Unfortunately it appears your logs are private. Can you either make them public (under Site Settings > Build & deploy > Continuous Deployment) or post the contents of it here.

Yeah sure thing. But I can’t find how to make my logs public under Continuous Deployment. Do I generate Public deploy key?

The option to make logs public only exists if your git repository is also public. If you have a private git repository or aren’t publishing from git, you won’t see the public/private option.

Ok, I made the repository public. Is there anything else I need to do in Netlify in order for you to see the logs?

If you share your git repository here, can look at that too.

My build settings do not look like that. They look like this.

Can you copy the text from the deploy log and paste it inside a code block here then.

Here it is… it was too big to send all at once so I’ll send as images…

Sorry, the best I can do is put it in pieces. Hope this helps… thank you for your help!

Using this post as reference try:

Removing the package-lock.json from your repository (you may need to do a “Clear cache and deploy site”
Screen Shot 2021-07-26 at 8.58.58 am

If that fails ensure you are using the latest build image.

I deleted my package-lock.json file and chose “Clear cache and deploy site” but it still failed.

9:28:23 PM: build-image version: fa439ad1ab9393b2c0d449d8d7c033927683f4b0
9:28:23 PM: build-image tag: v4.3.0
9:28:23 PM: buildbot version: b2c4edac4eab845e0e7ebe41f316f2179d56966b
9:28:23 PM: Building without cache
9:28:23 PM: Starting to prepare the repo for build
9:28:23 PM: No cached dependencies found. Cloning fresh repo
9:28:23 PM: git clone https://github.com/EndofLine4/my-dev-portfolio
9:28:25 PM: Preparing Git Reference refs/heads/master
9:28:25 PM: Parsing package.json dependencies
9:28:26 PM: Starting build script
9:28:26 PM: Installing dependencies
9:28:26 PM: Python version set to 2.7
9:28:26 PM: Downloading and installing node v16.8.0...
9:28:27 PM: Downloading https://nodejs.org/dist/v16.8.0/node-v16.8.0-linux-x64.tar.xz...
9:28:27 PM: Computing checksum with sha256sum
9:28:27 PM: Checksums matched!
9:28:30 PM: Now using node v16.8.0 (npm v7.21.0)
9:28:30 PM: Started restoring cached build plugins
9:28:30 PM: Finished restoring cached build plugins
9:28:30 PM: Attempting ruby version 2.7.2, read from environment
9:28:32 PM: Using ruby version 2.7.2
9:28:32 PM: Using PHP version 8.0
9:28:32 PM: Started restoring cached node modules
9:28:32 PM: Finished restoring cached node modules
9:28:32 PM: Installing NPM modules using NPM version 7.21.0
9:28:35 PM: npm ERR! code ERESOLVE
9:28:35 PM: npm ERR! ERESOLVE unable to resolve dependency tree
9:28:35 PM: npm ERR!
9:28:35 PM: npm ERR! While resolving: my-dev-portfolio@0.1.0
9:28:35 PM: npm ERR! Found: react@17.0.2
9:28:35 PM: npm ERR! node_modules/react
9:28:35 PM: npm ERR!   react@"^17.0.1" from the root project
9:28:35 PM: npm ERR!
9:28:35 PM: npm ERR! Could not resolve dependency:
9:28:35 PM: npm ERR! peer react@"^16.0.0" from react-typing-animation@1.6.2
9:28:35 PM: npm ERR! node_modules/react-typing-animation
9:28:35 PM: npm ERR!   react-typing-animation@"^1.6.2" from the root project
9:28:35 PM: npm ERR!
9:28:35 PM: npm ERR! Fix the upstream dependency conflict, or retry
9:28:35 PM: npm ERR! this command with --force, or --legacy-peer-deps
9:28:35 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
9:28:35 PM: npm ERR!
9:28:35 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
9:28:35 PM: npm ERR! A complete log of this run can be found in:
9:28:35 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-08-27T01_28_35_972Z-debug.log
9:28:35 PM: Error during NPM install
9:28:35 PM: Build was terminated: Build script returned non-zero exit code: 1
9:28:36 PM: Creating deploy upload records
9:28:36 PM: Failing build: Failed to build site
9:28:36 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
9:28:36 PM: Finished processing build request in 12.968253834s

It is also using the current Build Image.

Appears react-typing-animation is wanting react@16.0.0 however you are using react@17.0.1 in your project.

You could downgrade React to v16.0.0 to please react-typing-animation though this may impact other dependencies.

You can use NPM_FLAGS to specify --legacy-peer-deps.

Another thing to note, in src/components/Projects.jsx you have

import Proj1Before from '../images/dominicks-before.jpg'

however the file is ../images/Dominicks-before.jpg. This will also cause the build to fail is it won’t find the file. Filenames here are case-sensitive.

Thanks for all your help but it’s still not going through. I changed the image file import name to match the capital “Dominicks-before.jpg”. And I uninstalled the react-typing-animation package because I’m not using it anymore. But the error messages got even longer.
Honestly, thanks again.

type or p10:32:31 PM: npm ERR! /opt/buildhome/.cache/node-gyp/16.8.0/include/node/node.h:810:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
10:32:31 PM: npm ERR!   810 |       (node::addon_register_func) (regfunc),                          \
10:32:31 PM: npm ERR!       |                                           ^
10:32:31 PM: npm ERR! /opt/buildhome/.cache/node-gyp/16.8.0/include/node/node.h:844:3: note: in expansion of macro ‘NODE_MODULE_X’
10:32:31 PM: npm ERR!   844 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
10:32:31 PM: npm ERR!       |   ^~~~~~~~~~~~~
10:32:31 PM: npm ERR! ../src/binding.cpp:358:1: note: in expansion of macro ‘NODE_MODULE’
10:32:31 PM: npm ERR!   358 | NODE_MODULE(binding, RegisterModule);
10:32:31 PM: npm ERR!       | ^~~~~~~~~~~
10:32:31 PM: npm ERR! make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
10:32:31 PM: npm ERR! gyp ERR! build error
10:32:31 PM: npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
10:32:31 PM: npm ERR! gyp ERR! stack     at ChildProcess.onExit (/opt/build/repo/node_modules/node-gyp/lib/build.js:194:23)
10:32:31 PM: npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
10:32:31 PM: npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
10:32:31 PM: npm ERR! gyp ERR! System Linux 4.19.167+
10:32:31 PM: npm ERR! gyp ERR! command "/opt/buildhome/.nvm/versions/node/v16.8.0/bin/node" "/opt/build/repo/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
10:32:31 PM: npm ERR! gyp ERR! cwd /opt/build/repo/node_modules/node-sass
10:32:31 PM: npm ERR! gyp ERR! node -v v16.8.0
10:32:31 PM: npm ERR! gyp ERR! node-gyp -v v7.1.2
10:32:31 PM: npm ERR! gyp ERR! not ok
10:32:31 PM: npm ERR! Build failed with error code: 1
10:32:31 PM: npm ERR! A complete log of this run can be found in:
10:32:31 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-08-27T02_32_31_628Z-debug.log
10:32:31 PM: Error during NPM install
10:32:31 PM: Build was terminated: Build script returned non-zero exit code: 1
10:32:31 PM: Failing build: Failed to build site
10:32:31 PM: Finished processing build request in 3m52.533222947saste code here

Ok, I managed to get a successful build! :partying_face:

Changing the node version was the thing.

When I deployed I set things up like this

Specifying NODE_VERSION overrides the default node 16 used in the latest build image (node v14.17.1 is what I am running and is worked locally.)

I changed the build command to CI='' npm run build to not treat warnings as errors. This means that the warning

src/components/About.jsx
Line 129:13:  img elements must have an alt prop, either with meaningful text,
     or an empty string for decorative images  jsx-a11y/alt-text

doesn’t break the build. Alternatively, if you can add alt properties to your images to avoid the warnings.

I also made sure package-lock.json was in .gitignore and not pushed to the remote git repository.

I am in the same boat, can anyone help me also?

What is your issue @maxwood?

I already added CI=’’ npm run build to Build Settings before the last failed deploy.
I don’t have the option to change the NODE_VERSION through Netlify. So, I installed the latest version of node which is 14.17.5. However, I still see node 16 in my deploy log even though gitbash tells me I’m using version 14.17.5. I tried rolling back to 14.17.1 through gitbash but it didn’t work.

I deleted my package-lock.json from github and put it in .gitignore file, then pushed it to remote repository. But the build still failed. I think there’s just too many WARN and error messages that I need to fix before it’s deployed.

Hmm, what does your success log look like?