Reputation: 3869
This is my installation results:
success Saved 19 new dependencies.
info Direct dependencies
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
info All dependencies
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
success Saved 13 new dependencies.
info Direct dependencies
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ [email protected]
└─ [email protected]
info All dependencies
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ [email protected]
└─ [email protected]
But I still get these error messages:
Could not find a declaration file for module 'swagger-jsdoc'. 'C:/Users/A/Desktop/desktop/base_code/back_bc_node/node_modules/swagger-jsdoc/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/swagger-jsdoc` if it exists or add a new declaration (.d.ts) file containing `declare module 'swagger-jsdoc';`
Could not find a declaration file for module 'swagger-ui-express'. 'C:/Users/A/Desktop/desktop/base_code/back_bc_node/node_modules/swagger-ui-express/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/swagger-ui-express` if it exists or add a new declaration (.d.ts) file containing `declare module 'swagger-ui-express';`
And This is how I try to import it:
import swaggerJsdoc from "swagger-jsdoc";
import swaggerUi from "swagger-ui-express";
I don't know why do I get this error message because it was working on my previous application but doesn't work in the new application.I tried to reinstall swagger but didn't work.
Upvotes: 0
Views: 2632
Reputation: 597
Please try
yarn add @types/swagger-jsdoc swagger-jsdoc @types/swagger-ui-express swagger-ui-express
Then in your app.ts file
import swaggerJSDocs from "swagger-jsdoc";
import swaggerUi from "swagger-ui-express"
Upvotes: 1
Reputation: 3869
I tried following suggested commands within the error message and it worked:
npm i --save-dev @types/swagger-jsdoc
npm i --save-dev @types/swagger-ui-express
But it also created a new file named package-lock.json
inside my project that I don't know if is it a good thing or not, because I was using yarn
and this was the first npm
command I tried. Also I don't know if this new added file package-lock.json
was necessary to my project or not?
Upvotes: 1