First of all, they need to develop a better relationship with the major third parties. Even if they can't get third parties to make games for Wii U, it will make 3rd parties more likely to support the Wii U's successor. Also reduce the cost of licensing fees so that third parties will make their money back more easily from their Wii U games and will be more willing to port games (third parties sell so little on the Wii U that I doubt licensing fees are a major source of income for Nintendo, so it wouldn't reduce their profits by too much).
Second, they need to make the Wii U more appealing to consumers: make a gamepad-less SKU for around $200, advertise the Wii U more and expand their first-party library to appeal to a wider audience. Maybe even drop the price of their games only 6 months after they release, instead of once their next system is out like what they did with their Wii games. I, for one, would be more willing to buy their system if their games weren't so expensive for so long.