XTerra stalls and now won't restart

I have a 2000 Nissan Xterra. About a month ago it stalled while I was backing out of a parking spot. When I turned the key, the engine turned over but wouldn’t start. A few minutes later it started and I drove it on a long road trip. It was fine until today when it stalled when my husband was going around a corner. He waited a few minutes then it started. Now tonight he started it, drove down the block and it stalled again. This time it won’t restart. Any idea what the problem might be?

What does it do when you try to start it? Does it crank for awhile? Could be a Cam Position sensor