React-Native报错:找不到文件'expo-module-scripts/tsconfig.base'
解决tsconfig找不到'expo-module-scripts/tsconfig.base'的问题
以下是针对该报错的具体解决步骤:
确认依赖已安装:
expo-module-scripts包提供了tsconfig.base配置文件,先检查项目是否已安装该依赖。如果没有,执行以下命令安装:npm install expo-module-scripts --save-dev # 或使用yarn yarn add expo-module-scripts --dev验证TypeScript版本:确保项目中TypeScript版本不低于2.1(
extends特性从TS2.1开始支持)。查看当前版本:tsc -v若版本过低,执行升级命令:
npm install typescript@^2.1 --save-dev # 或使用yarn yarn add typescript@^2.1 --dev修复依赖安装异常:如果依赖已安装但仍报错,可能是依赖缓存或安装不完整导致。删除现有依赖文件后重新安装:
# 删除依赖目录和锁文件 rm -rf node_modules package-lock.json yarn.lock # 重新安装 npm install # 或使用yarn yarn install检查配置写法:确认
tsconfig.json中extends字段的写法正确,无需添加.ts后缀,原配置中的"expo-module-scripts/tsconfig.base"是正确的,因为TypeScript会自动识别.json后缀的配置文件。
内容的提问来源于stack exchange,提问作者Abdullah
相关产品推荐
相关产品推荐

