#Resolving module error despite successful installation

4 messages · Page 1 of 1 (latest)

spring pike
#

I'm attempting to utilize the @radix-ui/themes library. Despite successfully installing it, I continue to encounter an error whenever I attempt to employ it:Module '@radix-ui/themes' cannot be found, along with its associated type declarations During the project's creation, I deliberately selected TypeScript and confirmed that the configuration setup aligns with the documentation's recommendations. Could someone kindly help me understand why I'm still facing this error even after the package installation?

tepid lintelBOT
#

Hi @spring pike. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hmm, I don't know enough to give you a confident answer yet. The extracts provided do not contain specific information about the '@radix-ui/themes' library or the error you're encountering. However, I can provide some general advice based on the information available.

If you're using TypeScript with Astro, make sure you have installed the Astro TypeScript plugin (https://www.npmjs.com/package/@astrojs/ts-plugin) and added it to your tsconfig.json file. This plugin supports importing .astro files from .ts files, which can be useful for re-exporting.

npm install @astrojs/ts-plugin

And in your tsconfig.json:

"compilerOptions": {
 "plugins": [
 {
 "name": "@astrojs/ts-plugin"
 },
 ],
}

Also, ensure that you're using explicit type imports and exports whenever possible to avoid edge cases where Astro’s bundler may try to incorrectly bundle your imported types as if they were JavaScript.

import type { SomeType } from './script';

You can configure TypeScript to enforce type imports in your .tsconfig file by setting importsNotUsedAsValues (https://www.typescriptlang.org/tsconfig#importsNotUsedAsValues) to "error" or verbatimModuleSyntax (https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax) to true.

If the issue persists, it might be a problem with the package itself or how it's being imported. You might want to check the package's documentation or seek help from its maintainers.

For more information, you can refer to the Astro TypeScript Guide (https://docs.astro.build/en/guides/typescript).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@spring pike kapa.ai is still learning and improving, please let us know how it did by reacting below