目录
一:Cannot find type definition file for "@Type"
二:An accessor cannot be declared in an ambient context
一:Cannot find type definition file for "@Type"
- 翻译:找不到 '@types'. 类型的定义文件
场景复现:- 打包老项目时,package.json 里 @ionic/app-scripts 版本号是 3.2.4
- 故猜测 版本问题 导致报错
问题解决:- 降低 @ionic/app-scripts 版本,并重新安装
- npm i @ionic/app-scripts@3.2.3
二:An accessor cannot be declared in an ambient context
- ERROR in ../node_modules/@ionic/storage/storage.d.ts:113:9 - error TS1086: An accessor cannot be declared in an ambient context.
- 翻译:不能在环境上下文中声明访问器 —— An accessor cannot be declared in an ambient context.
猜想:看看有没有 storage.d.ts,如果有,就考虑版本冲突,太新的版本容易不兼容
解决方案:- 先卸载原有版本: npm uninstall @ionic/storage
- 再安装指定版本:npm i @ionic/storage@2.2.0
三:总结:插件版本太新容易导致不兼容