这是我的安装结果:
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]
但我仍然收到这些错误消息:
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';`
这就是我如何导入它:
import swaggerJsdoc from "swagger-jsdoc";
import swaggerUi from "swagger-ui-express";
我不知道为什么我得到这个错误消息,因为它是工作在我以前的应用程序,但不工作在新的应用程序。我试图重新安装swagger,但没有工作。
2条答案
按热度按时间2w3kk1z51#
我试着按照错误消息中建议的命令操作,结果成功了:
但它也在我的项目中创建了一个名为
package-lock.json
的新文件,我不知道这是不是一件好事,因为我正在使用yarn
,这是我尝试的第一个npm
命令。我也不知道这个新添加的文件package-lock.json
是否对我的项目是必要的?yftpprvb2#
请尝试
然后在app.ts文件中