Let $R $ be a commutative ring with 1 and $s $ a nonnilpotent element of $R $ such that for each idempotent $e $ of $R $ there exists a natural number $n_e $ such that either $s^{n_e}e=0$ or $s^{n_e}(1-e)=0$. Can we deduce that for each idempotent $e$ of $R$ either $s^me=0$ or $s^m(1-e)=0$ for a fix natural number $m $?

No. Consider the subring $R\subseteq\prod_{n\geq 1}\mathbb R[x]/(x^n)$ consisting of sequences $(a_n)$ whose constant terms converge to some limit. Let $s=(x,x,x,\dots)$. Then $s$ is nonnilpotent, since $s^n$ has nonzero coefficient in $\mathbb R[x]/(x^{n+1})$.

Now every idempotent $e$ in $R$ is equal to $0$ or $1$ in each coordinate, and is eventually constant. Replacing $e$ with $1-e$ if necessary, assume $e=(e_n)$ satisfies $e_n=0$ for $n>N$. Then $s^Ne=0$.

However, for $e=(1,\dots,1,0,0,\dots)$ with $n$ ones we have $s^{n-1}e\neq 0,s^{n-1}(1-e)\neq 0$, so we cannot pick one exponent for all idempotents.