Where are the docs?
The readme says one should check the nestjs documentation regarding the usage, but I couldn't find anything related to nest-cli usage in there.
Am I missing something?
The documentation is not yet published You ca see the repository https://github.com/nestjs/docs.nestjs.com to follow when it will be published
I tried to use the built in help command instead, however I hit a roadblock when generating a new module.
PS C:\Users\username\Documents\project-api-v3> nest generate module common/config
Unexpected string in JSON at position 31
Failed to execute command : @nestjs/schematics:module --name=common/config --dry-run=false, see above.
Failed to execute command : @nestjs/schematics:module --name=common/config --dry-run=false, see above.
PS C:\Users\username\Documents\project-api-v3> nest generate module src/common/config
Unexpected string in JSON at position 31
Failed to execute command : @nestjs/schematics:module --name=src/common/config --dry-run=false, see above.
Failed to execute command : @nestjs/schematics:module --name=src/common/config --dry-run=false, see above.
PS C:\Users\username\Documents\project-api-v3> nest generate module config src/common
Unexpected string in JSON at position 31
Failed to execute command : @nestjs/schematics:module --name=config --path=src/common --dry-run=false, see above.
Failed to execute command : @nestjs/schematics:module --name=config --path=src/common --dry-run=false, see above.
PS C:\Users\username\Documents\project-api-v3> nest --version
4.0.0-rc2
I tried different paths because I wasn't sure what base path it would try to use. Any idea what I am doing wrong?
With the stable 3.x version I had the same issue, which had been closed here: https://github.com/nestjs/nest-cli/issues/61 . Apparently it hasn't been fixed by the rewrite unless I am doing something wrong?
seems to be the module import that cause this issue... I'll reproduce it and find a way to fix it one time at all ;-)
Can't reproduce the bug on a VM with Windows 10 version... Can you bring nest info ? Your app.module.ts file maybe ?
The app.module.ts:
import { HelmetMiddleware } from '@nest-middlewares/helmet';
import { MiddlewaresConsumer, Module, RequestMethod } from '@nestjs/common';
import { ConfigModule } from './common/config/config.module';
import { AuthMiddleware } from './middlewares/auth/auth-middleware';
import { AuthService } from './middlewares/auth/auth.service';
import { JwtStrategy } from './middlewares/auth/passport/jwt.strategy';
import { PlayersModule } from './routes/players/players.module';
@Module({
imports: [ConfigModule, PlayersModule],
controllers: [],
components: [AuthService, JwtStrategy]
})
export class AppModule {
public configure(consumer: MiddlewaresConsumer): void {
consumer
.apply(HelmetMiddleware)
.forRoutes({ path: '*', method: RequestMethod.GET })
.apply(AuthMiddleware)
.forRoutes({ path: '*', method: RequestMethod.GET });
}
}
Test written to check what happens ! Hope this will be quickly fixed !
Try to release today to enjoy the cli with the fix ;-)
Please upgrade to 4.0.0 or 5.0.0 depends on the Nestjs major version you want to use