LeBron James had 40 points, 13 rebounds and six assists as the Cavaliers beat the Pistons in Cleveland.