Method of producing terpenes or terpenoids