I suppose the Spanish government didn't do a good enough job of convincing the Catalonian people that they are part of Spain.
The political parties promoting independence represent less citizens than the political parties that want Catalonia to be part of Spain.