The problem was not on the American side but due to the lack of initiative on the part of the fossilized Manchu elite. Basically it needed a personality change.
One of the interesting what ifs of late Qing dynasty history concerns the succession of Emperor Daoguang. When he died in 1850 he had two young sons (19 and 17 years old) as possible successors. He chose the elder son, who would become the Xianfeng Emperor. This would prove a very bad choice. When Xiangfeng died at age 30 from possibly syphilis, the throne passed to his 5 year old son Tongzhi, but in reality the empire was run by his mother, the notoriously xenophobic Empress Dowager Cixi. Her decades of hard line reactionary reign was the nail on the coffin for the dynasty.
Going back to 1850, Daoguang's younger son Prince Gong was by all accounts a responsible and practical person disposed toward reform. Had he been Daoguang's successor, China might have pulled the proverbial Meiji.
Of course this makes an inconvenient alternative history because it might also have changed the time line of the Taiping Rebellion. To minimize the unknown, there's another way Prince Gong could come to power. In 1875 Tongzhi died in his teens. For a time Prince Gong's son was the front runner for succession but this was over ruled by Cixi in favour of another child she could usurp, the Emperor Guangxu. Suppose Prince Gong led a coup against Cixi, that would make his son emperor and leave him regent.
From here on a reform would take place and lots of orders for industrial imports such as railways, machine tools, and ships would be made.