TS2307 Cannot find module highlightjs or its corresponding type declarations
This error message is indicating that your code is trying to import a module called 'highlight.js', but it cannot find it. This could be because:
-
You have not installed the 'highlight.js' package. You can install it by running
npm install highlight.jsin your project directory. -
You have installed the 'highlight.js' package, but you have not added it to your project's dependencies in the package.json file. You can add it by running
npm install highlight.js --savein your project directory. -
Your import statement may be incorrect. Make sure that you are importing the 'highlight.js' module correctly, and that the path to the module is correct.
-
If you are using TypeScript, you may also need to install the corresponding type declarations for 'highlight.js'. You can do this by running
npm install @types/highlight.jsin your project directory.
Once you have resolved the issue, the error should go away and you should be able to use the 'highlight.js' module in your code.
原文地址: https://www.cveoy.top/t/topic/byeu 著作权归作者所有。请勿转载和采集!