Why am I getting a "Cannot find module 'jsonLogic'" error?

587 views Asked by At

I've installed JsonLogic using Yarn.

yarn add json-logic-js

When I attempt to implement a simple example:

import jsonLogic from 'jsonLogic';

jsonLogic.apply({ '==': [1, 1] });

I get the following error:

Cannot find module 'jsonLogic'

Why can't Node find the JsonLogic module? And how do I resolve this issue?

1

There are 1 answers

0
Ryan Payne On BEST ANSWER

You're referencing a nonexistent module. Import the json-logic-js module, not the nonexistent jsonLogic module. For example:

import jsonLogic from 'json-logic-js';

jsonLogic.apply({ '==': [1, 1] });