我试图
import { ref } from 'vue'; import { onClickOutside } from '@vueuse/core'; import { useRoute } from 'vue-router';
从 vue 包导入任何属性,然后收到此错误。
Cannot find module 'vue-router'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?对于其他对象我也收到此错误Property 'xxxxxx' does not exist on type '{}'.
我添加了"moduleResolution":"node"编译器选项,然后我也遇到了同样的错误。
如何解决这个错误?
这对我有帮助
添加"moduleResolution": "node"到"compilerOptions"并tsconfig.app.json重启VSCode
{
...
"compilerOptions": {
...
"moduleResolution": "node"
}
}
Run Code Online (Sandbox Code Playgroud)
如果您使用的是 vscode,请尝试更改 volar 的 typescript 版本(工作区版本)。command + p然后搜索volar,你可能会看到这样的选项:
| 归档时间: |
|
| 查看次数: |
4454 次 |
| 最近记录: |