WAYLAND, Mass. — Hundreds of thousands of people across the Northeast shivered at the prospect of days without heat or lights after a freak October snowstorm over the weekend, and many towns postponed trick-or-treating Monday in what seemed like a mean Halloween prank to some children.

Families huddled under blankets and winter coats at home or waited out the crisis in shelters as utility crews struggled to fix power lines brought down by the storm. Hundreds of schools closed, giving youngsters one of the earliest snow days on record.

“Such a small storm but such a big disaster,” said Marina Shen, who spent Sunday night with her husband and dog at a middle school in Wayland, a Boston suburb of 13,000 where half the homes lost power. Just a few inches fell in Wayland, and most of it had melted by Monday, but overnight temperatures fell below freezing.

“The house is really, really cold. You cannot do anything. It’s so dark, cold,” Shen said. “Here they give us a hot shower.”

From Maryland to Maine, high winds and wet, heavy snow brought down trees, branches and wires Saturday and Sunday. Snowfall amounts ranged from less than inch in some places to 32 inches in the small town of Peru, Mass., in the Berkshire Mountains.

The storm was blamed for at least 21 deaths, including one in Canada. Most were caused by falling trees, traffic accidents or electrocutions from downed wires. Six people died in Pennsylvania alone.

More than 3 million homes and businesses in the Northeast lost power at the height of the storm. By midday Monday, that number was still above 2 million.

Some of the same areas were hit hard by the rainy remnants of Hurricane Irene just two months ago, but in many places the utility damage was worse this time. The trees had yet to lose their leaves and captured all too much of the snow.

“The leaves on the trees have made whole trees and huge branches come down and taken down more wires,” said New Jersey Gov. Chris Christie. “It’s a huge challenge for everybody.”

With the temperature rising again, the storm’s effects will probably outlast the snow itself.

Christie said he expected 95 percent of the 375,000 customers in New Jersey without power to have it back by Thursday, though he knew that would be little comfort to people shivering in the dark.

Companies brought in crews from other states to help, but with lights out and live wires down all over the place, many communities urged children to skip trick-or-treating or at least postpone it until later in the week.

In addition to ruining Halloween, the storm was turning into a budget nightmare for cities and towns already dealing with the costs of Irene.

“There’s no question that most municipal budgets are past bending and into breaking,” said William Steinhaus, the top elected official in Dutchess County, in New York’s Hudson Valley, which got nearly 2 feet of snow. “Whether it’s fuel money or overtime money or salt and sand material items, those line items are all stretched or broke at this point.”

Judd Everhart, a spokesman for the Connecticut Department of Transportation, said the agency spent more than $2 million of its $26 million snow-removal budget on keeping state roads clear during the storm.

In some places, commuters were forced to hunt for open gas stations after power outages knocked out the pumps. At a 7-Eleven in Hartford, Conn., two dozen cars waited in a line that stretched into the street and disrupted traffic.

“There’s no gas anywhere,” said Debra Palmisano of Plainville, Conn. “It’s like we’re in a war zone. It’s pretty scary, actually.”