Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running nest.js from VS Code

So, I'm playing around with this new framework http://nestjs.com/ who seems pretty awesome since it allows the usage of Typescript on Node, very likely to angular.

Using the starter https://github.com/kamilmysliwiec/nest-typescript-starter, I can run it with npm run start without any problem, but since there is a .vscode on the project, I assumed I could use VS Code to run and gain some debug abilities.

The problem is that when I run directly from VS Code, without changing anything in the code, I get the following problem:

Error: Cannot find module 'nest.js'

I tried to run from VS Code with and without it running from NPM, no success.

Thanks in advance.

like image 303
Victor Ivens Avatar asked May 19 '17 20:05

Victor Ivens


People also ask

How to debug Nest JS in VSCode?

Then, navigate to the debug pane in the VSCode activity bar by clicking on the icon or by using the keyboard shortcut ( ctrl+shift+D/cmd+shift+D ). Finally, select the Debug NestJS Framework configuration from the dropdown and run the debugger by pressing the start icon or using the keyboard shortcut (F5).

How do I enable auto attach in or code?

Open the settings in VS Code (CMD + , on Mac or CTRL + , on Windows). You can also go to the Command Palette (CMD + P on Mac or CTRL + P on Windows) and search for settings. Search for “auto attach” and you'll see a setting for Node: Auto Attach. Go ahead and turn that on.

How do I set launch JSON?

To create a launch.json file, click the create a launch.json file link in the Run start view. If you go back to the File Explorer view (Ctrl+Shift+E), you'll see that VS Code has created a .vscode folder and added the launch.json file to your workspace.


1 Answers

I updated nest-typescript-starter today. The previous version had an old dist directory, with outdated imported packages. If you want to compile your application, use npm run start:prod script.

like image 132
Kamil Myśliwiec Avatar answered Sep 18 '22 12:09

Kamil Myśliwiec