I had installed Xcode command line tools without Xcode a while back. I had to install Xcode to upgrade one of the compilers or something.
Also had to downgrade NPM npm install -g npm@4.6.1 and currently downgrading Node to v7 but it’s danger close to martini o’clock so this might need be continued on Monday.
I experienced a similar issue and simply switched to yarn as a replacement for npm. Have a look at their migration guide, it’s quick and painless. Also you might consider using a node version manager like n or nvm.