Skip to content

No output coming after giving command as "node mongotest.js" as command in powershell #5018

@Amalthomas-2002

Description

@Amalthomas-2002

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

The powershell of VScode is not giving the response for "node mongotest.js" input. There is a line console.log(....) which should give the response in powershell but nothing is coming.

PowerShell Version

Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      5.1.19041.4648                                                                          
PSEdition                      Desktop                                                                                 
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
BuildVersion                   10.0.19041.4648                                                                         
CLRVersion                     4.0.30319.42000                                                                         
WSManStackVersion              3.0                                                                                     
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1

Visual Studio Code Version

1.91.1
x64

Extension Version

ms-vscode.powershell@2024.2.2

Steps to Reproduce

const {MongoClient} = require("mongodb");
// mongodb://localhost:27017
var mongo=require("mongodb").MongoClient;
var url= "mongodb://localhost:27017/";

MongoClient.connect(url,function(err,db) {
if (err){
throw err;
}
else{
var mydb=db.db("studentdb");
mydb.createCollection("students",function(err,res){
if (err){
throw err;
}
else{
console.log("collection is creaated !");
console.log(res);
db.close();}
})
console.log("database created !");
db.close();
}
})

Output produced for this in power shell is:
PowerShell Extension v2024.2.2
Copyright (c) Microsoft Corporation.

https://aka.ms/vscode-powershell
Type 'help' to get help.

PS C:\Users\HP\Desktop\MyWebproject> node mongotest.js

Visuals

image

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions