GoldenEye saved the N64. It really did. If that game didn't come out in 1997, the system would've fallen apart during the basically 2-year wait between Mario 64 and Zelda: OoT.
What happened with the GameCube is they gave away the console FPS audience to Microsoft by not countering Halo and selling off Rare on top of that.
And Nintendo shot themselves in the foot repeatedly with the GameCube by making it look like a purple kid's toy, not having a proper Mario game at launch, cell-shading Zelda, etc. etc. etc.