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

[BUG] default template fails to run. #2995

Open
zinootje opened this issue Feb 21, 2025 · 5 comments
Open

[BUG] default template fails to run. #2995

zinootje opened this issue Feb 21, 2025 · 5 comments
Assignees
Labels

Comments

@zinootje
Copy link

Describe the bug

When initializing a new projectit fails to run. I found this trying to upgrade v7 to v8 when i couldn't get it working i tried a new project which also didn't work.

To Reproduce

run the @tsed/cli init and try to start the server. See code snippet for setting.

Expected behavior

Run without errors

Code snippets

npx -p @tsed/cli tsed init .
Need to install the following packages:
@tsed/cli@6.1.15
Ok to proceed? (y)
? Choose the target Framework: Express.js
? Choose the architecture for your project: Ts.ED
? Choose the convention file styling: Ts.ED
? Check the features needed for your project Passport.js, Documentation, Testing, Linter
? Choose a documentation plugin Swagger
? Choose unit framework Vitest
? Choose linter tools framework EsLint
? Choose extra linter tools Prettier, Lint on commit
? Choose the runtime: Node.js + SWC
? Choose the package manager: NPM
 Write RC files
 Initialize package.json
 Install plugins
 Write RC files
 Initialize package.json
 Install plugins
 Load plugins
 Install plugins dependencies
 Generate project files
 Install dependencies
 Generate barrels files

C:\Users\matty\ts.edTtest>npm start

> ts-ed-ttest@1.0.0 start
> npm run barrels && nodemon src/index.ts


> ts-ed-ttest@1.0.0 barrels
> barrels

[nodemon] 3.1.9
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src\**\*
[nodemon] watching extensions: ts,json
[nodemon] starting `node --enable-source-maps --import @swc-node/register/esm-register src/index.ts`

node:internal/modules/run_main:122
    triggerUncaughtException(
    ^
TypeError [Error]: Invalid URL
    at new URL (node:internal/url:818:25)
    at resolve (C:\Users\**\ts.edTtest\node_modules\@swc-node\register\esm.mts:220:17)
    at async nextResolve (node:internal/modules/esm/hooks:748:22)
    at async Hooks.resolve (node:internal/modules/esm/hooks:240:24)
    at async handleMessage (node:internal/modules/esm/worker:199:18) {
  code: 'ERR_INVALID_URL',
  input: '.\\file:\\C:\\Users\\**\\ts.edTtest\\src\\Server.ts'
}

Node.js v22.14.0
[nodemon] app crashed - waiting for file changes before starting...

Repository URL example

No response

OS

WIndows

Node version

v22.14.0

Library version

Latest from @tsed/[email protected]

Additional context

No response

@zinootje
Copy link
Author

After further testing i get the same error without selecting plugins.
thus the following config:
? Choose the target Framework: Express.js
? Choose the architecture for your project: Ts.ED
? Choose the convention file styling: Ts.ED
? Check the features needed for your project
? Choose the runtime: Node.js + SWC
? Choose the package manager: NPM

@Romakita
Copy link
Collaborator

Romakita commented Feb 25, 2025

hello @zinootje

Your issue seems to be related to Windows environment.

input: '.\\file:\\C:\\Users\\**\\ts.edTtest\\src\\Server.ts'

I haven't a Windows machine, it'll be complicated for me to fix that.

But the problem seems located in the generated code, Ts.ED doesn't concat any path.

@Romakita
Copy link
Collaborator

You can also to start the server without nodemon:

node --enable-source-maps --import @swc-node/register/esm-register src/index.ts

@Romakita
Copy link
Collaborator

Romakita commented Mar 1, 2025

@zinootje have you trying to debug the issue. Again I haven't a windows OS, so your help is needed. Try to isolate the problem, by comments lines in the index.ts, then uncomment until the bug occurs.

See you

@zinootje
Copy link
Author

zinootje commented Mar 2, 2025

Thanks for the followup. I got it working using ts-node node --loader ts-node/esm. So it seems to me it is a swc-node specific problem. I would love to help debug and isolate the problem just let me know how.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants