98 chev s-10 stalls during driving

I have a 98 s-10 that stalls if I do not let it idle for a few minutes after ignition and occasionally during driving. I have had the codes read at autozone. The crankshaft position sensor code came up. I replaced the sensor and this keeps happening and the same code comes up. I have changed the air filter, fuel filter, plugs etc. and I still ended up broken down one thousand miles in mexico, no joke. What could this be?

Jeff