为什么会出现“无法找到模块'jsonLogic'”错误?

时间:2020-01-10 21:40:46

标签: javascript node.js jsonlogic

我已经使用JsonLogic安装了Yarn

yarn add json-logic-js

当我尝试实现一个简单的示例时:

import jsonLogic from 'jsonLogic';

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

我收到以下错误:

Cannot find module 'jsonLogic'

为什么Node无法找到JsonLogic模块?以及我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

您引用的模块不存在。导入json-logic-js模块,而不是不存在的jsonLogic模块。例如:

import jsonLogic from 'json-logic-js';

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