Sorry to pass along bad news, but it may be that your ECM (Engine Control Module, aka Car Computer) is damaged. It is a common problem, at least with the 2001 Pathfinder/QX4. It happened to me, I got a quote for $1600 for the ECM+IACV, so I also had my car towed home. But first make sure you check your fuses, especially the ECM related ones. If it is the ECM you probably have 4 choices on the repair:
1) Dealer repair - likely $1000+
2) Send yours out for repair to a place such as Circuit Board Medics, around $300
3) Replace the damaged IC (integrated circuit) in your ECM, $15+. See the last couple of posts in this thread,
Idle Air Control Valve (IACV) Replacement DIY for 2001 Pathfinder
4) Find a used ECM. You may need to also reprogram your keys.
I sent my ECM to Circuit Board Medics last year and was satisfied with the service. Best of luck!