Try to install web3, without "-g", just npm install web3 (like the package states)
-g is used to have the command available in all directories, but you will only need web3 in your client javascript project.
EDIT 1: You can try adding the web3 script from a CDN like this: https://cdnjs.com/libraries/web3
EDIT 2:
To solve your npm problem in Ubuntu, try this (but is an OS issue, not web3):
sudo chown -R $(whoami) ~/.npm