The complex WKB method for nonlinear equations I