Skip to content

Module not found: Can't resolve 'validator' with version 3.0.7 #169

@aminacelik

Description

@aminacelik

I get this error with react-validation@3.0.7:

./src/utils/Validators.js
Module not found: Can't resolve 'validator' in '/Users/xxx/xxx/xxx/xxx/src/utils'

This is my ./src/utils/Validators.js file:

import React from 'react';
import validator from 'validator';
import ValidationErrorMsg from '../containers/ValidationErrorMsg';

export const required = (value) => {
  if (!value.toString().trim().length) {
    return (
    	<ValidationErrorMsg msg={'Required field.'} />
    );
  }
};

export const email = (value) => {
  if (!validator.isEmail(value)) {
    return "{ value } is not a valid email."
  }
};

export const password = (value, props, components) => {
	if (value !== components['confirm'][0].value) {
		return <span className="error">Passwords are not equal.</span>
	}
};

export const exactLength = (value, props) => {
  if (value.toString().trim().length !== props.exactLength) {
    return <span className="error">The value should be {props.exactLength} characters long.</span>
  }
}
```;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions