简体   繁体   English

为什么我会收到“找不到模块 'jsonLogic'”错误?

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

I've installed JsonLogic using Yarn .我已经使用Yarn安装了JsonLogic

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?为什么 Node 找不到 JsonLogic 模块? And how do I resolve this issue?我该如何解决这个问题?

You're referencing a nonexistent module.您正在引用一个不存在的模块。 Import the json-logic-js module, not the nonexistent jsonLogic module.导入json-logic-js模块,而不是不存在的jsonLogic模块。 For example:例如:

import jsonLogic from 'json-logic-js';

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么在使用 cloudinary 模块时出现“语法错误:无法在模块外使用导入语句”错误? - Why am I getting the 'SyntaxError: Cannot use import statement outside a module' error while using the cloudinary module? 为什么我收到此错误:声明&#39;<MODULE> &#39; 在本地,但不会导出 - Why I am getting this error: declares '<MODULE>' locally, but it is not exported 为什么我收到 Webpack 'module not found' 错误? - Why am I getting Webpack 'module not found' error? 我不断收到以下错误:“错误:找不到模块'./framer'” - I keep getting the following error: “Error: Cannot find module './framer'” 为什么我会收到“无法设置未定义的属性 'border'”错误? - Why am I getting the “Cannot set property 'border' of undefined” error? 我不断收到错误:找不到模块'./config.json/' - I keep getting Error: Cannot find module './config.json/' 获取节点模块错误(找不到模块) - Getting Node Module Error (Cannot find module) 为什么我收到无法重新声明httpGet()错误的原因 - why i am getting Cannot redeclare httpGet() error 无法将属性“ innerHTML”设置为null,为什么会出现此错误 - Cannot set property 'innerHTML' of null why am I getting this error 为什么我会收到“找不到已注册的别名”错误? - Why am I getting a "could not find a registered alias" error?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM