首页 > 解决方案 > 无法提交,因为 Prettier 无法识别新文件

问题描述

在提交之前,我正在使用 bazelisk 构建和测试我的代码。但是,我遇到了提交中止并出现错误的问题:

                    [0 / 8] [Prepa] BazelWorkspaceStatusAction stable-status.txt
                    INFO: Build completed successfully, 3 total actions
                    INFO: Build completed successfully, 3 total actions
                    Running frontend prettier
                    proj/dir1/dir2/src/components/ui/TextField.tsx 7ms
                    [error] No files matching the pattern were found: "proj/dir1/dir2/src/forms".
[error] No files matching the pattern were found: "proj/dir1/dir2/src/forms/myForm.tsx".
                    

这是一个更漂亮的问题吗?我正在使用 WebStorm,我的 IDE 也无法识别任何本地文件。我可以运行应用程序并进行更改,但我的导入是红色的,并带有错误

TS2307: Cannot find module 'src/components/ui/Button' or its corresponding type declarations.

这个问题与提交问题有关吗?由于 TS 错误消息,我相信这是一个打字稿问题,但是当它运行得更漂亮时提交失败,所以我不确定它们是相同的问题还是 2 个不同的问题。我该如何解决这个问题?

我尝试删除我的 node_modules 和 package-lock.json 以尝试使用 npm i 进行重置,但它遇到了这个问题。

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree

运行 npm i --legacy-peer-deps 创建节点模块和包锁,所以这不是一个大问题,但这是我的 IDE 和 prettier 无法识别本地文件的原因吗?外部导入中不存在错误,这使我相信 node_modules 和 package-lock 已正确设置。

任何指导表示赞赏。

标签: typescriptnpmbazel

解决方案


推荐阅读