U.S. wholesale chain Costco was forced to shut its first store in China early on its opening day on Tuesday, according to state media, after large crowds flocked through the door and caused traffic jams in the Shanghai neighborhood.

Videos posted on Chinese social media showed thousands of people crowding the aisles of the store in Shanghai's Minhang district, while signs outside warned incoming shoppers that they might have to wait three hours to park.

@HuXijin_GT: Instead of leaving China, US retail giant Costco opened its first Chinese store in Shanghai on Tuesday. Consumers waited in long queue to get inside the store. Such a grand opening can't be seen in other places. Chinese market is crucial to American companies.

One nearby school sent out an advisory to parents warning them about the traffic conditions. "Please expect the student dismissal this afternoon to be severely delayed due to the grand opening of Costco Supermarket," said the message.

The Paper, a media outlet run by the Shanghai government, reported on social media at 2:43 p.m. that the store had shut early, citing the local district government.

"Due to the extremely large crowds at the newly opened supermarket, for the safety of the public we urge that residents consume in a rational manner and choose to go shopping at an off-peak time," it quoted government officials as saying.

Costco did not immediately respond to a Reuters' request for comment.

Costco announced last month that it would open its first store in China. It first entered the country in 2014 through opening an online store on Alibaba Groups' Tmall online marketplace.

Its busy first day came as other big-name Western retailers such as Amazon, Tesco and Carrefour, are retreating from China having struggled to win market share in the face of strong competition from domestic rivals.