Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baseUrl not working in Nest 10 with swc #7603

Closed
KirianCaumes opened this issue Jun 29, 2023 · 56 comments
Closed

baseUrl not working in Nest 10 with swc #7603

KirianCaumes opened this issue Jun 29, 2023 · 56 comments
Assignees
Labels
Milestone

Comments

@KirianCaumes
Copy link

Describe the bug

When I run npm run start (nest start) in my project with NestJs 10 and swc enabled, an error is thrown:

> test-nestjs@0.0.1 start
> nest start

✔  TSC  Initializing type checker...
>  TSC  Found 0 issues.
>  SWC  Running...
Successfully compiled: 5 files with swc (26.57ms)
Error: Cannot find module 'app.module'
Require stack:
- /home/kirian/Projects/Perso/test-nestjs/dist/main.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/kirian/Projects/Perso/test-nestjs/dist/main.js:6:20)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)

Input code

No response

Config

{
    "$schema": "https://json.schemastore.org/swcrc",
    "sourceMaps": true,
    "jsc": {
        "parser": {
            "syntax": "typescript",
            "decorators": true,
            "dynamicImport": true
        },
        "baseUrl": "./src"
    },
    "minify": false
}

Playground link

https://github.com/KirianCaumes/nestjs-bug-swc-import

Expected behavior

It should work the same way as without swc enabled and with baseUrl being used.

// src/main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from 'app.module'; // 👈

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(5002);
}
bootstrap();
// nest-cli.json
{
  "$schema": "https://json.schemastore.org/nest-cli",
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "builder": "swc",
    "typeCheck": true
  }
}
// tsconfig.json
{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./src",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false
  }
}
//package.json
{
  "scripts": {
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch"
  },
  "dependencies": {
    "@nestjs/common": "^10.0.3",
    "@nestjs/core": "^10.0.3",
  },
  "devDependencies": {
    "@nestjs/cli": "^10.0.5",
    "@swc/cli": "^0.1.62",
    "@swc/core": "^1.3.67",
    "typescript": "^5.1.6"
  },
}

Actual behavior

Import with non-relative modules are not found

Version

1.3.67

Additional context

I already posted an issue on NestJs, but they redirected me here.

@kdy1 kdy1 added this to the Planned milestone Jun 30, 2023
@kdy1 kdy1 self-assigned this Jun 30, 2023
@kdy1
Copy link
Member

kdy1 commented Jul 3, 2023

I think this is a duplicate

@kdy1 kdy1 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2023
@KirianCaumes
Copy link
Author

@kdy1 can you link the original issue in this case? I can't find it

@kdy1 kdy1 modified the milestones: Planned, v1.3.68 Jul 5, 2023
@KirianCaumes
Copy link
Author

I see you put the bug in milestone v1.3.68 @kdy1
I just tested version 1.3.68, and the bug is still present.
The repository in my initial message is up to date on this.

@kdy1
Copy link
Member

kdy1 commented Jul 7, 2023

It's not fixed. It's duplicate

@kdy1
Copy link
Member

kdy1 commented Jul 7, 2023

I told you.

@KirianCaumes
Copy link
Author

Okay, that's a misinterpretation on my part, sorry. I thought the bug was fixed in version 1.3.68, hence my feedback! 😅
Could you share the link of the issue to follow then? I can't find it

@Spoutnik97
Copy link

@KirianCaumes I don't find the duplicate neither

@SzymonDukla

This comment has been minimized.

@swc-project swc-project temporarily blocked SzymonDukla Jul 25, 2023
@jovicailievski

This comment has been minimized.

@kdy1
Copy link
Member

kdy1 commented Aug 1, 2023

@jovicailievski https://kdy1.dev/posts/2023/1/plus-1-is-spam

@swc-project swc-project temporarily blocked jovicailievski Aug 1, 2023
@Mnigos

This comment was marked as spam.

@kdy1
Copy link
Member

kdy1 commented Aug 10, 2023

@gabrielcipriano
Copy link

@KirianCaumes have you managed to make it work?

@wp-harm
Copy link

wp-harm commented Aug 16, 2023

@gabrielcipriano In this NestJS 10 boilerplate the SWC compiler works, so I'd suggest to look what they did there. Only on Windows it fails to serve due to a bug in SWC: nestjs/nest#12214

@kdy1
Copy link
Member

kdy1 commented Aug 16, 2023

@wp-harm If it fails only on windows, is it related to #7806 ?

@wp-harm
Copy link

wp-harm commented Aug 16, 2023

@kdy1 I'm not entirely sure as the errors or setups vary slightly.

It basically is this (the rest of the thread should give the necessary context): nestjs/nest#11891 (comment)
The person above says on Unix it works, on MacOS it works as well I can confirm and it seems this person as well: nestjs/nest#11891 (comment). So therefore the path alias only fails on Windows.

Reading the thread a bit more closely, I do notice this comment which is pretty much the same error/conclusion as the issue you refer to: nestjs/nest#11891 (comment). It would be interesting to see if the resulting compilation is different on MacOS or Unix. I could try this if you want me to 👍

@kdy1 kdy1 reopened this Aug 17, 2023
@kdy1 kdy1 modified the milestones: v1.3.68, Planned Aug 17, 2023
@wp-harm
Copy link

wp-harm commented Aug 17, 2023

@kdy1 I did a bit more research on my Windows PC. Switching to the non-SWC compiler I got a relative path that allowed my app to work. Going back to SWC I got an absolute path which did not work. Manually making the path relative by changing the compiled JS file (just like it was in the non-SWC dist) and my app worked again.

So the tl:dr, if the path can be become relative on Windows at least some of the issues will be resolved, maybe all of them as think many people don't realise their OS is the problem! 💪

@KirianCaumes
Copy link
Author

I'm not sure my orignal problem is Windows related because I'm working with WSL (Ubuntu 20.04) on a Windows 11 computer. I think the problem must be same on a real Linux machine, even if I'm not 100% sure.

I updated the "Playground link repo" in my first message to SWC 1.3.77 version, and the problem is a bit different:

> test-nestjs@0.0.1 start
> nest start

✔  TSC  Initializing type checker...
>  TSC  Found 0 issues.
>  SWC  Running...
thread '<unnamed>' panicked at 'base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.', /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.173.31/src/path.rs:104:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.', /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.173.31/src/path.rs:104:13
thread '<unnamed>' panicked at 'base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.', /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.173.31/src/path.rs:104:13
failed to handle: base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.
thread 'thread '<unnamed><unnamed>' panicked at '' panicked at 'base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.', ', /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.173.31/src/path.rs/usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.173.31/src/path.rs::104104::1313

failed to handle: base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.
failed to handle: base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.
failed to handle: base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.
failed to handle: base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.
Failed to compile 5 files with swc.

 Error  Failed to compile:
src/app.controller.spec.ts
src/app.controller.ts
src/app.module.ts
src/app.service.ts
src/main.ts

Then if I do one of this action on my .swcrc, I have the following error:

  • Remove `"baseUrl": "./src"
  • Set the baseUrl to an absolute path like /home/xxx/swc-nestjs/src
> test-nestjs@0.0.1 start
> nest start

✔  TSC  Initializing type checker...
>  TSC  Found 0 issues.
>  SWC  Running...
Successfully compiled: 5 files with swc (22.08ms)
Error: Cannot find module 'app.module'
Require stack:
- /home/kirian/Projects/Perso/test-nestjs/dist/main.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/kirian/Projects/Perso/test-nestjs/dist/main.js:6:20)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)

@KirianCaumes
Copy link
Author

It's better! Now it can resolve app.module!

But I have tried more things, and it seems to still not be perfectly working.

I created a simple CRUD, and now I have this error:

> test-nestjs@0.0.1 start
> nest start

✔  TSC  Initializing type checker...
>  TSC  Found 0 issues.
>  SWC  Running...
Successfully compiled: 10 files with swc (31.16ms)
Error: Cannot find module 'users/users.service'
Require stack:
- /home/kirian/Projects/Perso/test-nestjs/dist/users/users.module.js
- /home/kirian/Projects/Perso/test-nestjs/dist/app.module.js
- /home/kirian/Projects/Perso/test-nestjs/dist/main.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/kirian/Projects/Perso/test-nestjs/dist/users/users.module.js:12:23)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
// app.module.ts

import { Module } from '@nestjs/common';
import { UsersModule } from 'users/users.module';

@Module({
  imports: [UsersModule],
  controllers: [],
  providers: [],
})
export class AppModule {}
// users.module.ts

import { Module } from '@nestjs/common';
import { UsersService } from 'users/users.service';
import { UsersController } from 'users/users.controller';

@Module({
  controllers: [UsersController],
  providers: [UsersService],
})
export class UsersModule {}
// users.service.ts

import { Injectable } from '@nestjs/common';
import { CreateUserDto } from 'users/dto/create-user.dto';
import { UpdateUserDto } from 'users/dto/update-user.dto';

@Injectable()
export class UsersService {
  create(createUserDto: CreateUserDto) {
    return 'This action adds a new user';
  }

  findAll() {
    return `This action returns all users`;
  }

  findOne(id: number) {
    return `This action returns a #${id} user`;
  }

  update(id: number, updateUserDto: UpdateUserDto) {
    return `This action updates a #${id} user`;
  }

  remove(id: number) {
    return `This action removes a #${id} user`;
  }
}

I have tried several "paths" config, but didn't manage to make it works 😕

I'm not sure if it's any help, but the dist/users/users.module.js generated with the classic Nest compiler contains this:

const common_1 = require("@nestjs/common");
const users_service_1 = require("./users.service");
const users_controller_1 = require("./users.controller");

But with SWC:

const _common = require("@nestjs/common");
const _usersservice = require("users/users.service");
const _userscontroller = require("users/users.controller");

My repo is also up to date: https://github.com/KirianCaumes/nestjs-bug-swc-import

@kdy1
Copy link
Member

kdy1 commented Aug 24, 2023

@KirianCaumes I'm working on a fix for it with #7852

@m-nouman-munir

This comment was marked as off-topic.

@kdy1
Copy link
Member

kdy1 commented Aug 25, 2023

I'll mark it as off-topic as 1 and 2 are not related to this issue at all and 3 is a duplicate

@m-nouman-munir

This comment was marked as spam.

@kdy1
Copy link
Member

kdy1 commented Aug 25, 2023

First, 1 is not a bug. And auto import has nothing to do with SWC

@m-nouman-munir
Copy link

m-nouman-munir commented Aug 25, 2023

I mean absolute paths. When an import is like src/etc/etc, I face Can not find module, and it only happens when using SWC. with old ts compiler it works fine. And about 1 , without SWC, that also works fine.All those three issues i'm facing when I use SWC.

@kdy1
Copy link
Member

kdy1 commented Aug 25, 2023

Issue occurs only if I use SWC does not mean it's a bug of SWC

@m-nouman-munir

This comment was marked as off-topic.

@kdy1

This comment was marked as off-topic.

@m-nouman-munir
Copy link

Sorry for inconvenience. But Nest Js sent the first person here to report. And I found my cases similar to him. So I also reported here. As I wasn't able to find the solution at stackoverflow as well.

@kdy1
Copy link
Member

kdy1 commented Aug 25, 2023

@m-nouman-munir Can you try v1.3.79 once https://github.com/swc-project/swc/actions/runs/5972622833 is finished?

  • 1 is not a bug. Per-file basis is by design.
  • 2 is not related to SWC at all. I didn't know what it is.
  • 3 should be fixed by v1.3.79

@m-nouman-munir
Copy link

m-nouman-munir commented Aug 25, 2023

1-Sure I'll Try that.

2- The Auto Import Issue. Let me just explain it a little bit.
2.1-I have an export enum X{} in src/enum/enum.ts
2.2-I have a schema Y, in Y there is a property z : X , in src/components/Y.ts.
2.3-Now I have to import X in Y. SO when I use ctl + . , in vscode to import X. It imports like import {X} from 'src/enum.enum'. And With SWC it throws error TypeError: Can not found module X , and if I disable SWC and use the other tsc or babel compiler which by default NEST JS uses, It does not throw error.
2.4-After error. When I change the import to like import { X } from '../../../enum/enum' , by my self ,It works fine with SWC.

2.5- I'M ON UBUNTU

@kdy1
Copy link
Member

kdy1 commented Aug 25, 2023

Actually, import {X} from 'src/enum.enum' this part is 3 and it'll be fixed by the new version

@m-nouman-munir
Copy link

Yes, by reading all the above messages, I totally understood that. But my mistake I wasn't able to explain things clearly and put you under confusion. And also that's why I explained the entire point 1. As it was happening due to import issues, and also solved by itself when I changed things related to imports in .swcrc and tscnofig.json.

@kdy1
Copy link
Member

kdy1 commented Aug 25, 2023

@KirianCaumes
Copy link
Author

Hey, thanks a lot!
I just tried it, but now it seems there's a problem with node_modules imports:

> test-nestjs@0.0.1 start
> nest start

✔  TSC  Initializing type checker...
>  TSC  Found 0 issues.
>  SWC  Running...
Successfully compiled: 10 files with swc (29.65ms)
Error: Cannot find module 'node_modules/@nestjs/core/index.js'
Require stack:
- /home/kirian/Projects/Perso/test-nestjs/dist/main.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/kirian/Projects/Perso/test-nestjs/dist/main.js:5:15)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)

The import of node_modules/@nestjs/core/index.js in dist/main.js (generated from src/main.ts) looks like this:

"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
const _core = require("node_modules/@nestjs/core/index.js");
const _appmodule = require("./app.module");
async function bootstrap() {
    const app = await _core.NestFactory.create(_appmodule.AppModule);
    await app.listen(5002);
}
bootstrap();

//# sourceMappingURL=main.js.map

And I don't think it was prefixed with node_modules/ before.

I also tried to edit paths from .swcrc, but I didn't find a solution either 😕

My repo is up to date: https://github.com/KirianCaumes/nestjs-bug-swc-import

@m-nouman-munir
Copy link

I changed version in my package.json to v1.3.79. But still it fails when run npm run build

@m-nouman-munir
Copy link

m-nouman-munir commented Aug 25, 2023

I'm also finding Error: Cannot find module 'node_modules/@nestjs/common/index.js' with nest start --watch

@kdy1
Copy link
Member

kdy1 commented Aug 25, 2023

#7863

@m-nouman-munir
Copy link

So v.1.3.80 available now?

@KirianCaumes
Copy link
Author

It now works perfectly with version 1.3.80!
I also tested it with a larger NestJs project, and I did not find any issue at all.
Thank you so much for your time an effort @kdy1! 👏

@m-nouman-munir
Copy link

@KirianCaumes or @kdy1 can you help me I'm still facing issue. I Installed latest SWC version.But When I try to build my project It does not get's build.And I face

thread 'thread '<unnamed><unnamed>' panicked at 'thread '' panicked at 'base_dir(./src) must be absolute. Please ensure that jsc.baseUrlis specified correctly. This cannot be deduced by SWC itself because SWC is a transpiler and it does not try to resolve project details. In other works, SWC does not know which directory should be used as a base directory. It can be deduced if.swcrcis used, but if not, there are many candidates. e.g. the directory containingpackage.json, or the current working directory. Because of that, the caller (typically the developer of the JavaScript package) should specify it. If you see this error, please report an issue to the package author.thread '<unnamed><unnamed>base_dir(./src) must be absolute. Please ensure that jsc.baseUrlis specified correctly. This cannot be deduced by SWC itself because SWC is a transpiler and it does not try to resolve project details. In other works, SWC does not know which directory should be used as a base directory. It can be deduced if.swcrcis used, but if not, there are many candidates. e.g. the directory containingpackage.json, or the current working directory. Because of that, the caller (typically the developer of the JavaScript package) should specify it. If you see this error, please report an issue to the package author.
Error Failed to compile

**And If I do nest start --watch I face **

⠋ TSC Initializing type checker...Error: Cannot find module 'src/app.module'

Settings

.swcrc

{
  "$schema": "https://json.schemastore.org/swcrc",
  "sourceMaps": true,
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "decorators": true,
      "dynamicImport": true
    },
    "baseUrl": "./src",
    "paths": {
      "*": ["*", "src/*"]
    }
  },
  "minify": false
}

nest-cli.json

{
  "$schema": "https://json.schemastore.org/nest-cli",
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "builder": "swc",
    "typeCheck": true
  }
}

tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "ES2021",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./src",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false
  }
}

@m-nouman-munir
Copy link

@KirianCaumes how your nest js versions are

 "@nestjs/cli": "^10.1.16",
    "@nestjs/schematics": "^10.0.2",
    "@nestjs/testing": "^10.2.1",

mine are not going upward from

"@nestjs/cli": "^10.0.0",
        "@nestjs/schematics": "^10.0.0",
        "@nestjs/testing": "^10.0.0",

@KirianCaumes
Copy link
Author

Hey @m-nouman-munir,

Here is what I have:

// package.json
{
  "dependencies": {
    "@nestjs/common": "^10.2.1",
    "@nestjs/core": "^10.2.1",
  },
  "devDependencies": {
    "@nestjs/cli": "^10.1.16",
    "@swc/cli": "^0.1.62",
    "@swc/core": "^1.3.80",
}
// nest-cli.json
{
  "$schema": "https://json.schemastore.org/nest-cli",
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "builder": "swc",
    "typeCheck": true
  }
}
// tsconfig.json
{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./src",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false
  }
}
// .swcrc
{
    "$schema": "https://json.schemastore.org/swcrc",
    "sourceMaps": true,
    "jsc": {
        "parser": {
            "syntax": "typescript",
            "decorators": true,
            "dynamicImport": true
        },
        "baseUrl": "./src",
        "paths": {
            "*": [
                "*"
            ]
        }
    },
    "minify": false
}
// main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from 'app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(5002);
}
bootstrap();
// app.module.ts
import { Module } from '@nestjs/common';
import { UsersModule } from 'users/users.module';

@Module({
  imports: [UsersModule],
  controllers: [],
  providers: [],
})
export class AppModule {}

I hope that will help!

You can also try to delete node_modules and package-lock.json and then run npm i, just in case

@m-nouman-munir
Copy link

Does region matters for nest cli or core versions?

@m-nouman-munir
Copy link

As I mentioned before that your nest versions are latest or updated. But my versions are stuck at 10.0.0. I tried ti manually write new versions in package.json, but when I do npm i it reverts to 10.0.0. I tried by creating a seperate whole new nestjs project even the version is stuck to 10.0.0 as well.

@m-nouman-munir
Copy link

I changed .swcrc ,paths: [ ] settings then I deleted node_modules and package-lock.json and then run npm i. Now it's working Thanks.

@swc-bot
Copy link
Collaborator

swc-bot commented Sep 25, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests