Back

[SOLVED] Could not find a declaration file for module 'appwrite'

  • 1
  • Web
nicosemp
17 May, 2023, 11:43

I created it with the usual npm init vue@latest

TL;DR
User was experiencing an issue with finding a declaration file for the 'appwrite' module in Vue/Next.js. Another user suggested changing the 'tsconfig.json' file's 'moduleResolution' to 'node' which solved the problem. Another user suggested trying the 'tsconfig.app.json' file instead. User confirmed that adding `"moduleResolution": "node"` inside `compilerOptions` in 'tsconfig.app.json' resolved the issue. The error was only present in the IDE, not during runtime.
nicosemp
17 May, 2023, 11:44

choosing all yes except JSX, Vitest and Cypress

Binyamin
17 May, 2023, 11:46

Okay,

nicosemp
17 May, 2023, 11:47

The problem persists even by removing "module": "ESNext" from tsconfig.node.json. By the way, the app runs fine! The problem is with the IDE: I get no autocomplete and everything from appwrite is 'any' type

Binyamin
17 May, 2023, 11:47

Ohh

Binyamin
17 May, 2023, 11:48

It's interesting, because Appwrite has typescript

nicosemp
17 May, 2023, 11:48

The error is only in the IDE

nicosemp
17 May, 2023, 11:49

I know it has typescript, I remember it had it since 0.6 right?

nicosemp
17 May, 2023, 11:49

That's why I was confused 🤔

nicosemp
17 May, 2023, 11:50

Thanks a lot for the time you're taking to help, I appreciate it

Binyamin
17 May, 2023, 11:50

I don't know since when, but yes they have

nicosemp
17 May, 2023, 12:00

The project is brand new, I haven't changed any config of the originally generated ones

Binyamin
17 May, 2023, 12:31

Okay, I've tested in my computer In your tsconfig.app.json add "moduleResolution": "node", inside compilerOptions like so:

TypeScript
{
  "extends": "@vue/tsconfig/tsconfig.dom.json",
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
  "exclude": ["src/**/__tests__/*"],
  "compilerOptions": {
    "moduleResolution": "node",
    "composite": true,
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

Let me know if it solves the problem

nicosemp
17 May, 2023, 13:25

Unfortunately this didn't solve the problem, I wish I could give you more info but the error is exactly the same

Binyamin
17 May, 2023, 13:26

I was able to have the same error as you

Binyamin
17 May, 2023, 13:26

When adding this line in the tsconfig.app.json file it changes.

Maybe you can try to restart your IDE?

nicosemp
17 May, 2023, 13:29

wait sorry I just tried the tsconfig.node.js file! let me try the tsconfig.app.json one, makes sense

nicosemp
17 May, 2023, 13:32

It worked, thanks a lot!! <:appwritefire:823999000330895380>

nicosemp
17 May, 2023, 13:37

[Solved] Could not find a declaration file for module 'appwrite'

nicosemp
17 May, 2023, 13:37

[SOLVED] Could not find a declaration file for module 'appwrite'

Drake
17 May, 2023, 20:09
heyy_harshh
14 Aug, 2023, 14:49

Can someone help me with this? This all is for Vue. Can someone help me with nextjs. When i am using this, i am not able to use Client, Databases etc

safwan
14 Aug, 2023, 15:21

it's pretty much the same if you're using TS. Just head to the tsconfig.json file and change moduleResolution to "node"

Drake
14 Aug, 2023, 15:39
heyy_harshh
14 Aug, 2023, 16:34

Okay thanks

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more