ref
From near + -ly.
nearly (adv.)
1530s, "carefully," 1570s, "close at hand, in close proximity;" see near + -ly (2). Meaning "almost, all but, within a little of" is from 1680s.