WASHINGTON — The House approved on Thursday night a stopgap spending bill to keep the government open past Friday, but Senate Democrats — angered by President Donald Trump’s vulgar aspersions and a lack of progress on a broader budget and immigration deal — appeared ready to block the measure.

The House approved the measure 230-197, despite conflicting signals Trump sent throughout the day and a threatened rebellion from conservatives that failed to materialize. The bill would fund the government through Feb. 16.

Shortly after the stopgap bill cleared the House, Senate Republicans said they would hold a vote later Thursday night to proceed to the measure.

In the Senate, at least a dozen Democratic votes will be needed to approve the measure, and there is little chance those will materialize. Democrats are intent on securing concessions that would, among other things, protect from deportation young immigrants brought to the country illegally as children, increase domestic spending, aid Puerto Rico and bolster the government’s response to the opioid crisis.

In addition to keeping the government open, the bill would provide funding for the Children’s Health Insurance Program for six years, and it would delay or suspend a handful of taxes imposed by the Affordable Care Act.

In the Senate, Democrats were unifying around a “no” vote. If the stopgap bill passes, Sen. Chuck Schumer of New York, the Democratic leader, said, “there will be no incentive to negotiate, and we’ll be right back here in a month with the same problems at our feet.”

The perilous day on Capitol Hill began with the president firing off a Twitter message that undermined his party’s strategy to keep the government open. Republican leaders spent Wednesday pressuring Democrats to vote for the spending bill, arguing that opposing it would effectively block a six-year extension of the Children’s Health Insurance Program, or CHIP, which they had included in the spending bill. Funding for the program lapsed at the end of September.

Yet on Thursday morning, Trump suggested that the funding should not be part of the stopgap bill, writing on Twitter: “CHIP should be part of a long-term solution, not a 30 Day, or short term, extension!”