In many cases there will be no problem, but it depends on the publisher. 

Public sharing of preprints, in order to gather feedback about the work, is common in many disciplines. There are some journals, however, and many book publishers, who require exclusive publication and/or first publication rights, and will reject a work that has already been distributed online. Consult the publication agreement or guidelines of the publishers you plan to work with for more information.