相关推荐recommended
VUE报错解决Could not find a declaration file for module ‘xxx‘.
作者:mmseoamin日期:2023-11-30

Github上下载的代码,导入后出现以下报错。

VUE报错解决Could not find a declaration file for module ‘xxx‘.,第1张

 

 错误代码

Could not find a declaration file for module 'element-plus/dist/locale/zh-cn.mjs'. 'c:/Users/Lenovo/typescript/hotel/hotel-system-web-main/node_modules/element-plus/dist/locale/zh-cn.mjs' implicitly has an 'any' type.

If the 'element-plus' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'element-plus/dist/locale/zh-cn.mjs';`ts(7016)

解决办法:

修改tsconfig.json文件,

追加一下内容

    "noImplicitAny": false,

    "allowJs": true,

VUE报错解决Could not find a declaration file for module ‘xxx‘.,第2张

 小白一个,原理不懂,但该报红已解决。

 VUE报错解决Could not find a declaration file for module ‘xxx‘.,第3张