簡體   English   中英

使用 Yarn 3 在 NestJs 中找不到模塊或其相應的類型聲明

[英]Cannot find module or its corresponding type declarations in NestJs with Yarn 3

我創建了一個像這樣的 NestJs 應用程序:
nest new.
文件已生成並運行:
yarn
安裝所有依賴項。
然后運行:
yarn start:dev
這是錯誤:

src/app.controller.ts:1:33 - error TS2307: Cannot find module '@nestjs/common' or its corresponding type declarations.

1 import { Controller, Get } from '@nestjs/common';
                                  ~~~~~~~~~~~~~~~~

src/app.module.ts:1:24 - error TS2307: Cannot find module '@nestjs/common' or its corresponding type declarations.

1 import { Module } from '@nestjs/common';
                         ~~~~~~~~~~~~~~~~

src/app.service.ts:1:28 - error TS2307: Cannot find module '@nestjs/common' or its corresponding type declarations.

1 import { Injectable } from '@nestjs/common';
                             ~~~~~~~~~~~~~~~~

src/main.ts:1:29 - error TS2307: Cannot find module '@nestjs/core' or its corresponding type declarations.

1 import { NestFactory } from '@nestjs/core';

紗線版本:3.2.2
節點版本:16.16.0
嵌套版本:9.1.2

有任何想法嗎?

我相信問題可能出在 yarnv3 上。 使用與您相同的版本時,我遇到了同樣的問題。 一旦我回滾到 yarn1.22.19,我就不再收到任何錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM