Multiple ERPNext app with Multiple site setup

Hi ,
Is it possible to create multiple ERPNext app with multiple site setup? If it is possible please provide the solution or followed steps .
I have tried to use two apps ERPNext1 ,ERPNext2(rename ERPNext app → create two apps like ERPNext1,ERPNext2) and created two sites site1,site2 ,again install the ERPnext1 app to site1 and ERPNext2 app to site2 ,but i have face some issues in server setup(production).Two apps are running on different port successfully ,but i got the error when i was opening some doctype form ,example when i was open customer form i got the error “Uncaught (in promise) ReferenceError: erpnext is not defined”.But first app ERPNext1 is working fine ,second app ERPNext2 only got issues in opening customer form . Kindly provide the correct solution.

Thanks in Advance.