neovim [import-prefix-missing no-local: Unable to load a loc



这是一个令人讨厌的问题,因为它不影响程序的运行,但当打开一个新的(或现有的)NestJS应用程序时,所有导入都被标记为错误例如,如果我们查看main.ts文件,有两个导入:

import { NestFactory } from '@nestjs/core' // <-- (1)
import { AppModule } from './app.module'   // <-- (2)

错误1:

import-prefix-missing:相对导入路径"@nestjs/core"没有前缀/或./或../from "file:///Users/me/Documents/hello-world/src/main.ts

错误2:

no-local:无法加载本地模块:"file:///Users/me/Documents/hello-world/src/app.module"。请检查文件路径

这些错误在VSCode或WebStorm中不会显示当谷歌这些错误时,它们与Deno/Python有关,我没有安装Deno,但为Neovim安装了python2和python3

在运行应用程序时没有错误并且运行得很好,但是当使用ExpressKoa有或没有typescript时,我没有得到这个错误。这个问题只存在于NestJS中。

可以在.vimrc中手动设置。在这里,'deno' linter可以省略typescript:

".vimrc
...
let g:ale_linters = { 'typescript': ['eslint', 'tsserver', 'typecheck'] }

如下所述:https://github.com/dense-analysis/ale#faq-disable-linters

:ALEInfothen说:

Current Filetype: typescript
Available Linters: ['deno', 'eslint', 'standard', 'tslint', 'tsserver', 'typecheck', 'xo']
Enabled Linters: ['eslint', 'tsserver', 'typecheck']
Ignored Linters: []

所以看起来我正在使用的计算机DID已经安装了Deno并且正在处理它并且存在冲突。所以我需要找到一种方法来配置它与NeoVim。我通过运行命令:ALEDetail来解决这个问题,并从以下位置提供了额外的信息:

[deno]: mport-prefix-missing:相对导入路径"@nestjs/core"没有前缀/或./或../from "file:///Users/me/Documents/hello-world/src/main.ts

我的错

相关内容

最新更新