Error in coc.nvim: Cannot find module '@tauri-apps/api/tauri' (TS2792) #7965
-
I just wanted to try and make an empty app with tauri, but the first thing I got in my IDE (Neovim + coc.nvim + coc-tsserver with no specific configuration) is this: import { useState } from "react";
import reactLogo from "./assets/react.svg";
import { invoke } from "@tauri-apps/api/tauri";
import "./App.css";
This (thankfully) obviously fixes the error: import { invoke } from "../node_modules/@tauri-apps/api/tauri"; The problem is that in both |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
I did resolve this by writing in "paths": {
"@tauri-apps/api/tauri": ["./node_modules/@tauri-apps/api/tauri"]
}, But this doesn't explain why I get the error in the first place (and not everybody else). Update 1: Update 2: |
Beta Was this translation helpful? Give feedback.
-
any update? |
Beta Was this translation helpful? Give feedback.
-
make changes to tsconfig.json add "paths": {
"@tauri-apps/api/tauri": ["./node_modules/@tauri-apps/api/tauri"]
}, Then where you need invoke function import { invoke } from "@tauri-apps/api/primitives" |
Beta Was this translation helpful? Give feedback.
-
I resolved it by running |
Beta Was this translation helpful? Give feedback.
I did resolve this by writing in
tsconfig.json
>compilerOptions
:But this doesn't explain why I get the error in the first place (and not everybody else).
Update 1:
I run an Ubuntu docker container and with minimal copying of my existing setup this and other errors are not present. Now I need to figure out why is that.
Update 2:
I think I know what was wrong. I had to run
CocUpdate
and wait for coc plugins to update (includingtsserver
). After this, all errors magically disappear.