Let $f:X\rightarrow S$ be a smooth projective morphisms of noetherian schemes and let $\mathcal{O}(1)$ be a relatively ample line bundle. Let $\mathcal{E}$ be a coherent sheaf over $X$ and flat over $S$. Suppose there exists an open subscheme $U\subset X$ such that $\mathcal{E}|_U$ is locally free and complement of $U$ has codimension atleast $2$ in $X$. Can we define determinant of $\mathcal{E}$? i.e., is there a line bundle on $X$ which is the "determinant" of $\mathcal{E}$?
Note that $\mathcal{E}$ is not torsion free. But has the extra assumption that there exists an open subscheme $U\subset X$ such that $\mathcal{E}|_U$ is locally free and complement of $U$ has codimension atleast $2$ in $X$.