#nest g resource failing

50 messages · Page 1 of 1 (latest)

median oasis
#

Why does nest g resource categories throw this error?


Failed to execute command: node @nestjs/schematics:resource --name=categories --no-dry-run --no-skip-import --language="ts" --source-root="src" --spec --no-flat```
#

welp guess i'll get no work done this weekend

potent bone
#

Have you tried with this command npx nest g resource categories ?

median oasis
#

I hadn't, but same error when i try

potent bone
#

Have you tried reinstalling the NestJS CLI?

median oasis
#

like 50 times, on all js package clients

potent bone
#

Alternatively, you can use this command npx @nestjs/cli@latest without installing the cli globally.

median oasis
#

npm uninstall -g @nestjs/cli, npm install -g @nestjs/cli, yarn global add @nestjs/cli, etc

median oasis
#

everything I try gives that same damn error, no frustrating

#

and there's no helpful error message beyond what it gives

#

so I have no idea why it's not working

#

it's probably some bs typescript/node_module/config issue

potent bone
#

What version of the NestJS CLI do you have installed?

median oasis
#

9.3.0

potent bone
#

Very strange, I just installed the latest version and tried and me it works( see screenshot) what operating system are you using ?

median oasis
#

ok that is bizarre

#

I'm on macos

potent bone
#

Me too, what version of Node do you use?

#

I'll try using pnpm and yarn see if I can replicate the error

median oasis
#

node v18.12.1

#

tried on node v16 and got the same error

potent bone
#

I am using node v18.15 but I don't know if it is a nodejs version issue.

median oasis
#

I'll try that specific version but I doubt that's the cause

#

yeah no dice

#

going to guess it's a typescript issue, but exactly what im not sure

potent bone
#

I tried using pnpm and it works for me

median oasis
#

yeah I have no idea what the difference is tbh

#

let me try on a new app

#

yeah that works, so it's an app-specific issue

#

but like... what?

potent bone
#

Even with yarn and ok

#

so with a fresh installation it works for you right?

median oasis
#

yeah a fresh app works, but my medium sized existing app doesn't

#

but I have no idea how to troubleshoot it

potent bone
#

what version do you have of the package @nestjs/cliin package.json ?
and how did you set up the nest-cli.json?

median oasis
#

"@nestjs/cli": "^9.0.0" in package.json, and nest-cli.json is ```json
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": true
}
}

potent bone
#

everything seems ok, another idea I can think of is to try to update nestjs dependencies to the latest versions

median oasis
#

tried that about 5 minutes ago, all the package version in the new nest js i put into my existing nest app, same error

#

the only difference now is that my existing app has all of the project-specific dependencies, but i'd be surprised if they were causing the error

#

my tsconfig.build.json files as the experimental decorators feature enabled, but again i doubt that's the culript

#

my terminal also throws the error, so it's not a VSCode issue

#

lol not sure what else to check honestly

#

maybe it's a prisma thing (although again i don't imagine why it would be), maybe it's a typescript thing (but where)

potent bone
#

Very strange, the only one would be to create a minimal reproduction on a cloneable git repository as soon as you have some time.
You can also make a post in this topic: https://github.com/nestjs/nest-cli/issues/1987 since it is not locked

GitHub

Is there an existing issue for this? I have searched the existing issues Current behavior Failed to execute command: node @nestjs/schematics:resource --name=user --no-dry-run --project="pn...

median oasis
#

yeah could do that, as a short term solution I might just generate inside a /tmp repository and copy over to my project

#

thanks for debugging with me man, i'll revisit it again next week

potent bone
#

You're welcome, if I can help I will gladly do so. 👍