filePath not found of @umijs/renderer-react/node_modules/@types/react #9362
Replies: 5 comments 4 replies
-
同样 的问题,在大佬的解释下完美解决了:因为yarn/npm install的时候,.umi下生成的文件与其原有的冲突了,只需要把源文件下src下的.umi删除,重新npm/yarn install就完美解决 |
Beta Was this translation helpful? Give feedback.
-
亲测删除node_modules/.cache文件夹即可,用grep -r命令可以在这个文件夹里搜到绝对路径,所以包括项目文件夹更名或者移动,都会出现filePath not found的错误,把node_modules/.cache文件夹删掉重新跑就行,应该可以不用再npm install |
Beta Was this translation helpful? Give feedback.
-
我的解决方法是:找到全局的 yarn/npm 缓存目录,全部删除,然后全局安装与项目package.josn文件里umi版本对应的umi;然后删除项目下node_module,删除src下.umi,重新yarn, yarn start。之后正常工作 |
Beta Was this translation helpful? Give feedback.
-
删掉.cache .umi 文件后重新, yarn install yarn start 好了 |
Beta Was this translation helpful? Give feedback.
-
在用yarn create umi myapp创建的antd pro+TS项目中,使用useState,编辑器会提示使用下边这个。👇
import { useState } from '@umijs/renderer-react/node_modules/@types/react';
版本如下:
umijs version: [email protected]
antd-pro version: [email protected]
但是yarn start的时候会报错。错误信息如下:
AssertionError [ERR_ASSERTION]: filePath not found of @umijs/renderer-react/node_modules/@types/react at E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:119:27 at Generator.next (<anonymous>) at asyncGeneratorStep (E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:64:103) at _next (E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:66:194) at E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:66:364 at new Promise (<anonymous>) at E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:66:97 at figureOutExport (E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:129:17) at E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\DepBuilder.js:184:201 at Generator.next (<anonymous>) at asyncGeneratorStep (E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\DepBuilder.js:84:103) at _next (E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\DepBuilder.js:86:194) at processTicksAndRejections (node:internal/process/task_queues:96:5)
但是node_modules文件中确实是有这个路径的【@umijs/renderer-react/node_modules/@types/react】,也有index.d.ts文件,是不是哪里需要配置一下?希望各位大神,遇到过类似情况,不吝赐教。
当然,在文件引入的时候,也有错误提示。如下:
找不到模块“@umijs/renderer-react/node_modules/@types/react”或其相应的类型声明。ts(2307)
tsconfig.json路径配置如下:
"paths": {
"@/": ["./src/"],
"@@/": ["./src/.umi/"]
}
我试着在@/这里的路径加"./node_modules/",进行尝试。
"paths": {
"@/": ["./src/", "./node_modules/"],
"@@/": ["./src/.umi/*"]
}
在用yarn create umi myapp创建的antd pro+TS项目中,使用useState,编辑器会提示使用下边这个。👇
import { useState } from '@umijs/renderer-react/node_modules/@types/react';
版本如下:
umijs version: [email protected]
antd-pro version: [email protected]
但是yarn start的时候会报错。错误信息如下:
AssertionError [ERR_ASSERTION]: filePath not found of @umijs/renderer-react/node_modules/@types/react at E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:119:27 at Generator.next (<anonymous>) at asyncGeneratorStep (E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:64:103) at _next (E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:66:194) at E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:66:364 at new Promise (<anonymous>) at E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:66:97 at figureOutExport (E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\utils.js:129:17) at E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\DepBuilder.js:184:201 at Generator.next (<anonymous>) at asyncGeneratorStep (E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\DepBuilder.js:84:103) at _next (E:\web\cloud-frontend\node_modules\umi\node_modules\@umijs\preset-built-in\lib\plugins\features\mfsu\DepBuilder.js:86:194) at processTicksAndRejections (node:internal/process/task_queues:96:5)
但是node_modules文件中确实是有这个路径的【@umijs/renderer-react/node_modules/@types/react】,也有index.d.ts文件,是不是哪里需要配置一下?希望各位大神,遇到过类似情况,不吝赐教。
当然,在文件引入的时候,也有错误提示。如下:
找不到模块“@umijs/renderer-react/node_modules/@types/react”或其相应的类型声明。ts(2307)
tsconfig.json路径配置如下:
"paths": {
"@/": ["./src/"],
"@@/": ["./src/.umi/"]
}
我试着在@/这里的路径加"./node_modules/",进行尝试。
"paths": {
"@/": ["./src/", "./node_modules/"],
"@@/": ["./src/.umi/*"]
}
依然失败。。。。
感觉只是一个路径配置问题。
依然失败。。。。
感觉只是一个路径配置问题。
Beta Was this translation helpful? Give feedback.
All reactions