Japan's largest airline, ANA, and its competitor JAL have each grounded their entire fleet of Boeing 787 Dreamliners after an emergency landing due to a smoke alarm in the cockpit – the most dramatic of a spate of incidents involving the troubled aircraft over the past week and since its inception.

All Nippon Airways said the plane had been evacuated, with its eight crew and all 129 passengers exiting safely on inflatable slides. Instruments in the cockpit indicated there had been a battery malfunction and the pilot had noticed a strange smell.

ANA said the plane diverted to Takamatsu, western Japan, at 8.45am on Wednesday. It had been bound for Haneda airport in Tokyo.

A spokesman for the Osaka airport authority said the plane had left Yamaguchi at 8am and made the emergency landing after the smoke alert.

The incident is certain to rock global airlines' confidence in the new aircraft, which went into commercial service just over a year ago after a three-year delay caused by design and production problems.

In the aftermath of the emergency landing, both ANA and JAL said they were grounding all their Dreamliners until satisfied they are safe to fly. The incidents have caused particular concern in Japan, the Dreamliner's biggest market, with ANA and Japan Airlines (JAL) flying 24 of the 50 planes to have rolled off the production line so far.

ANA is the biggest operator of the 787 in the world so far, having taken delivery of 17 aircraft including the first one flown commercially.

The aircraft has been hit by half a dozen incidents in the past week, including two fuel leaks, a battery fire, a wiring problem, a brake computer fault and a cracked cockpit window. Before that there had been engine failures during testing and in one case a Dreamliner cargo plane was forced to cancel takeoff when one of its General Electric turbines lost power.

US aviation officials said the aircraft was safe and it was not unusual for new models to experience minor mishaps, but the recent incidents have inevitably raised questions over the Dreamliner's safety. More than 800 Dreamliners have been ordered by airlines around the world.

The aircraft was supposed to have heralded a new era in commercial flight. Boeing officials say the plane, which is made of carbon fibre and other lightweight materials, is 20% more fuel-efficient than conventional airliners and 30% cheaper to maintain, and features design improvements for more comfortable medium and long-haul flights.

Boeing spokesman Marc Birtel told Reuters: "We've seen the reports, we're aware of the events and are working with our customer."

On Tuesday, Japan's transport ministry said it was launching an investigation into the cause of two fuel leaks on a JAL Dreamliner. That came after US transport authorities and Boeing started a joint investigation into the aircraft's manufacturing, design and assembly.

"Looking at this from the point of view of average citizens, having these sort of incidents occur seemingly day after day, one could become very uneasy," Akihiro Ota, Japan's transport minister, told reporters.

"We plan to look into the scale of these accidents and what the overall situation is. We will convey the message to those who operate [the plane] that it is absolutely necessary to be safe."