在构建'找不到名称'排除'后出现lodash错误 [英] following lodash error on build 'Cannot find name 'Exclude''

查看:297
本文介绍了在构建'找不到名称'排除'后出现lodash错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在跟踪lodash错误

I am getting following lodash error

node_modules/@types/lodash/common/object.d.ts(1689,12)中的错误:错误 TS2304:找不到名称排除". node_modules/@types/lodash/common/object.d.ts(1766,12):错误TS2304: 找不到名称排除". node_modules/@types/lodash/common/object.d.ts(1842,34):错误TS2304: 找不到名称排除".

ERROR in node_modules/@types/lodash/common/object.d.ts(1689,12): error TS2304: Cannot find name 'Exclude'. node_modules/@types/lodash/common/object.d.ts(1766,12): error TS2304: Cannot find name 'Exclude'. node_modules/@types/lodash/common/object.d.ts(1842,34): error TS2304: Cannot find name 'Exclude'.

推荐答案

解决方案1 ​​
我也遇到了同样的问题,我尝试将打字稿版本和lodash版本降级,但是没有任何效果,最后我尝试安装@ types/lodash,并且它起作用了. 只需尝试一下:

Solution 1
I also had the same issue, i tried to downgrade typescript version and lodash version, but nothing worked, and at last i tried installing @types/lodash, and it worked. just try this:

npm i @types/lodash

希望有帮助.

如果上述解决方案不起作用,请尝试以下操作:

解决方案2
实际的问题是,排除已添加到2.8版的打字稿中.您可能有一个@ types/lodash版本,该版本至少需要打字稿2.8,如果您的lodash和打字稿版本不匹配,则可能会发生这种情况.

If the above solution doesn't work try this:

Solution 2
The actual issue is, Exclude was added to typescript on version 2.8. You might have a version of @types/lodash that needs minimum typescript 2.8, and it can happen if your lodash and typescript version didn't match.

因此,使用此代码安装与lodash兼容的最新打字稿2.3版本:

So, install the last typescript 2.3 version compatible with lodash using this code :

npm i -D @types/lodash@ts2.3

这篇关于在构建'找不到名称'排除'后出现lodash错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆