nest-cli icon indicating copy to clipboard operation
nest-cli copied to clipboard

[ERROR] nest generate doesn't work when a module is called with forRoot()

Open antoinm opened this issue 8 years ago • 2 comments

I've been trying to generate a new module with the nest-cli but I got Unexpected token . in JSON at position 57

Running it again with verbose enabled, I noticed that the error is happening when going through the app.module.ts, it seems like it's failing on reading module names for which the forRoot() function is called.

Here is the output of the verbose mode :

[DEBUG] - ModuleMetadataParser::extractMetadataText() - text : { imports: [ CommonModule, MongooseModule.forRoot(process.env.DB_URL [DEBUG] - ModuleMetadataParser::format() - contentFormat : { "imports": [ "CommonModule", "MongooseModule"."forRoot"("process"."env"."DB"_"URL"

Unexpected token . in JSON at position 57

When I remove the .forRoot(), the command works fine.

antoinm avatar Feb 23 '18 10:02 antoinm

hey @antoinm, Thx for your feedbacks !

We're currently working on the angular schematics way to generate artefacts and fix this issue.

Thanks to waiting for the next release...

thomrick avatar Feb 23 '18 13:02 thomrick

The CLI tool was rebuild from scratch and integrate schematics to generate assets. Please upgrade to v4.0.0-rc1

thomrick avatar Apr 01 '18 10:04 thomrick