The hard part is especially NPM since of the dependency load it's impossible to keep track of all the licenses.
I don't know if they have anything to prevent problems.
The way a lot of people use Browserify and Webpack is totally illegal - if it strips copyright notices in code comments from the JS source as it minifies it ;)