![](/img/trans.png)
[英]Cannot find module 'graphql-hooks' or its corresponding type declarations
[英]Why I got this error Cannot find module 'nestjs/common' or its corresponding type declarations
我正在嵌套 js 中创建 controller 这是文件 auth.controller.ts
import { Controller } from 'nestjs/common';
@Controller()
export class AppController {}
为什么我会收到此错误? 错误 TS2307:找不到模块“nestjs/common”或其相应的类型声明。
我安装了所有依赖项,删除了 dist 文件夹,然后重新运行 yarn start:dev。
这是我所有的依赖项。
package 被称为@nestjs/common
,而不是nestjs/common
然后:
import { Controller } from '@nestjs/common';
提示:仔细阅读文档https://docs.nestjs.com/controllers
如果您更正了错字,但您仍然收到错误
cannot find module '@nestjs/common' or its corresponding type declarations.
然后你可能需要安装
npm install @nestjs/common
npm install @nestjs/core
它对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.