I need advice to debug deploy Netlify App
I can successfully compile in my local environment, but can not pass Netlify’s compilation robot.
And how should I get debug logs from npm?
Hi there,
If you’re having building troubles, this article is the best place to start reading: [Support Guide] Debugging Netlify site builds . Over 99% of problems we find are covered in that article. It has next steps as to what you should let us know after you’ve run through all the things in the article like setting appropriate versions/variables at Netlify to help us match your local.
If you need to see a debug log like that (tip: you probably don’t; the advice in the article I linked is likely to clear up the problem), you can use a pattern like this for a build command:
npm run build ; cat /opt/buildhome/.npm/_logs/*-debug.log ; sleep 200 ; false
This build command will ALWAYS cause your build to fail instead of being published, but will output the file before doing so, so you can read it.
Or, you could build locally inside our build environment, using these tips: GitHub - netlify/build-image: This is the build image used for running automated builds - which will let you read the log directly yourself after the build fails.
Thank you very much for your reply.After a few days of testing, I have discovered the problem: because I am in China, I will use Taobao’s yarn mirror source (https://registry.npm.taobao.org/) for development, but NetlifyThere is a problem with the domestic network access, which makes it impossible to obtain complete modules when pulling the Taobao mirror.After I changed to the official source address of yarn (https://registry.yarnpkg.com), the compilation would pass.
Wow, I had never heard of that use pattern before! Thank you SO MUCH for taking time time to share this solution with us so that others can find it in the future if they work similarly to you!