This question comes up pretty often on here. It is possible, though difficult, to arrange such a scenario. To my mind, though, the principle challange to a Nazi German and Nationalist Chinese alliance is not the problems of preventing the Militarist takeover of Japan and the steering of Japan into a total war with China, nor the question of how much Nazi Germany could really aid Chinese military modernization at a time when they desperately need every resource they can get to build up their own military at home and when any aid they tried to send could be easily cut off by either the British or the Japanese, as fundamental as these issues are. No, the biggest problem is, to be frank, the doubtful value of 1930s China as a military ally to Germany.
It is interesting to note that, when the Nazi leadership talked about the alliance with Militarist Japan prior to the launching of war upon the USSR, they almost exclusively spoke of her navy. Not only was the IJN formidable, Japan was also the only major naval power that might conceivably be turned against Britain and the US. Germany was, of course, aware that much of the reason for their defeat in the first war was the huge amount of material and, later, soldiers brought to Europe from North America. Although Germany concocted some plans to build up a large navy, the leadership was, in the end, aware that their nation was primarily a continental power. Of course, no Japanese warships would ever be deployed in the North Atlantic, but any naval war between Militarist Japan and the US and UK, or even the threat of such, would necessarily tie down a large amount of naval resources that would otherwise be used against Germany and Italy. Japan was valuable as an ally for this reason, and because they could threaten Western colonial holdings in Asia. In contrast, the China of this time period has virtually no ability to project power outside of its own borders, and none at all to either tie down foreign naval forces or to threaten island colonies like the DEI. Therefore, Nazi Germany has no reason to prefer an alliance with China over one with Japan in any scenario in which the latter alliance still seems possible. Therefore, the most important first step in any ChineseーGerman Alliance is to prevent any possibility of a JapaneseーGerman understanding.