James rebukes us for seeking friendship with the world at the expense of our relationship with God, for in the process we make ourselves enemies of God (James 4:4).
To back up the point, James questioned,
“Or do you think that the Scripture says in vain, ‘The Spirit who dwells in us yearns jealously’?” (James 4:5).
The general teaching of Scripture is that the Spirit of God dwells in us and He is jealous, for our God is a jealous God, wanting our exclusive loyalty.
The Scripture does not teach such things in vain. Why then seek friendship with the world? We do not want to be found fighting against the Spirit of God!