Professors refusing to write recommendation letter due to change of field
Your professors are in essence, trying to help. They think that their letters would not carry enough weight to help you. They may be thinking about if they'd admit a student from a different field whose letter-writers said nothing about their chemistry experience (and apparently deciding they would not). Professor's time is valuable, and they don't want to spend it writing a letter that they think would be useless.

But once I said I am not applying for a chemistry degree but ECE/CS 2 of my references said they cannot give me the reference for non-chemistry related programs since they know nothing about my programming skills.

I do not know whether you need letters that espouse your programming skills, but the solution is to:

Tell the professors that you have already got a letter-writer addressing your programming skills, and ask them to write about something more specific, like your research experience, or go-getting-ness (etc., etc.). You have a letter that explains why you'd be a good ECE/CS student, right?
Explain why that's not a concern, and then ask them to focus on something more specific.

If they still refuse, unfortunately, there is little you can do.