Most answered questions in Node-js

0 votes
1 answer

How to append to New Line in Node.js

Hello @kartik, you're running this on Windows (given ...READ MORE

Sep 7, 2020 in Node-js by Niroj
• 82,880 points
27,255 views
0 votes
1 answer

How to get the _id of inserted document in Mongo database in NodeJS?

Hello @kartik, A shorter way than using second ...READ MORE

Sep 7, 2020 in Node-js by Niroj
• 82,880 points
13,198 views
0 votes
1 answer

How do I get the time of day in javascript/Node.js?

Hello @kartik, This function will return you the ...READ MORE

Sep 7, 2020 in Node-js by Niroj
• 82,880 points
861 views
0 votes
1 answer

How to get all count of mongoose model?

Hello @kartik, The reason your code doesn't work ...READ MORE

Sep 7, 2020 in Node-js by Niroj
• 82,880 points
4,106 views
0 votes
1 answer

How do I determine the current operating system with Node.js?

Hello @kartik, With Node.js v6 (and above) there ...READ MORE

Jul 20, 2020 in Node-js by Niroj
• 82,880 points
461 views
0 votes
1 answer

How to install a private NPM module without my own registry?

Hello @kartik, Try: cd somedir npm install . or npm install path/to/somedir somedir must ...READ MORE

Jul 20, 2020 in Node-js by Niroj
• 82,880 points
606 views
0 votes
1 answer

How to append to a file in Node?

Hello @kartik, you can use appendFile, which creates a ...READ MORE

Jul 20, 2020 in Node-js by Niroj
• 82,880 points
512 views
0 votes
1 answer

How to print a stack trace in Node.js?

Hello @kartik, Any Error object has a stack member that traps the ...READ MORE

Jul 20, 2020 in Node-js by Niroj
• 82,880 points
2,517 views
0 votes
1 answer

How to create a directory if it doesn't exist using Node.js?

Hello @kartik, Try this: var fs = require('fs'); var dir ...READ MORE

Jul 20, 2020 in Node-js by Niroj
• 82,880 points
561 views
0 votes
1 answer

How to retrieve POST query parameters?

Hello @kartik, This will do it if you ...READ MORE

Jul 20, 2020 in Node-js by Niroj
• 82,880 points
461 views
0 votes
1 answer

Error:npm WARN package.json: No repository field

Hello @kartik, It's just a check as of NPM ...READ MORE

Jul 20, 2020 in Node-js by Niroj
• 82,880 points
4,121 views
0 votes
1 answer

How is an HTTP POST request made in node.js?

Hello @kartik, A easier way if you use ...READ MORE

Jul 20, 2020 in Node-js by Niroj
• 82,880 points
657 views
0 votes
1 answer

How to parse JSON using Node.js?

Hello @kartik, You can simply use JSON.parse. The definition of ...READ MORE

Jul 20, 2020 in Node-js by Niroj
• 82,880 points
476 views
0 votes
1 answer

How to host a Node.Js application in shared hosting?

Hello @kartik, You can run node.js server on a typical ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
6,739 views
0 votes
1 answer

How to get access to webpack-dev-server from devices in local network?

Hello @kartik, You can set your ip address ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
5,633 views
0 votes
1 answer

How to make connection to Postgres via Node.js?

Hello @kartik, Here is an example I used ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
1,418 views
0 votes
1 answer

Error:npm not working after clearing cache

Hello @kartik, Try this: npm cache clean --force OR It ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
6,097 views
0 votes
1 answer

What is the best way to run npm install for nested folders?

Hello @kartik, If you want to run a ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
13,549 views
0 votes
1 answer

How do I use HTML as the view engine in Express?

Hello @kartik, To make the render engine accept ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
9,332 views
0 votes
1 answer

How to set custom favicon in Express?

Hello @kartik,  Just use: app.use('/favicon.ico', express.static('images/favicon.ico')); OR In express: //you probably ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
5,035 views
0 votes
1 answer

How to execute an external program from within Node.js?

Hello @kartik, Exec has memory limitation of buffer ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
3,729 views
0 votes
1 answer

How can I use an http proxy with node.js http.Client?

Hello @kartik, You can use request, I just found ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
10,002 views
0 votes
1 answer

How do I install the babel-polyfill library?

Hello @kartik, If your package.json looks something like ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
1,553 views
0 votes
1 answer

How to get the server's port?

Hello @kartik, I use this way Express 4: app.listen(1337, ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
612 views
0 votes
1 answer

How do I update devDependencies in NPM?

Hello @kartik, To update package.json in addition to ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
6,842 views
0 votes
1 answer

Error: CERT_UNTRUSTED while using npm command

Hello @kartik, You can bypass https using below ...READ MORE

Jul 17, 2020 in Node-js by Niroj
• 82,880 points
2,886 views
0 votes
1 answer

How do I uninstall a package installed using npm link?

Hello @kartik, The package can be uninstalled using ...READ MORE

Jul 16, 2020 in Node-js by Niroj
• 82,880 points
3,800 views
0 votes
1 answer

How do you log content of a JSON object in Node.js?

Hello @kartik, Try this one: console.log("Session: %j", session); If the ...READ MORE

Jul 16, 2020 in Node-js by Niroj
• 82,880 points
711 views
0 votes
1 answer

How do I add a custom script to my package.json file that runs a javascript file?

Hello @kartik, I have created the following, and ...READ MORE

Jul 16, 2020 in Node-js by Niroj
• 82,880 points
39,928 views
0 votes
1 answer

How to programmatically send a 404 response with Express/Node?

Hello @kartik, The method is: res.sendStatus(404); Express will send a ...READ MORE

Jul 16, 2020 in Node-js by Niroj
• 82,880 points
3,244 views
0 votes
1 answer

How do I install a module globally using npm?

Hello @kartik, I found the output contained the ...READ MORE

Jul 16, 2020 in Node-js by Niroj
• 82,880 points
544 views
0 votes
1 answer

How to redirect 404 errors to a page in ExpressJS?

Hello @kartik, You can put a middleware at ...READ MORE

Jul 16, 2020 in Node-js by Niroj
• 82,880 points
3,664 views
0 votes
1 answer

Error:NPM global install “cannot find module”

Hello @kartik, I got this error Error: Cannot find ...READ MORE

Jul 16, 2020 in Node-js by Niroj
• 82,880 points
15,921 views
0 votes
1 answer

Error:“NODE_ENV” is not recognized as an internal or external command, operable command or batch file

Hello @kartik, It sounds like your error comes ...READ MORE

Jul 16, 2020 in Node-js by Niroj
• 82,880 points
19,488 views
0 votes
1 answer

How can i get the extension of the image in node.js?

Hello @kar You can do the following to ...READ MORE

Jul 16, 2020 in Node-js by Niroj
• 82,880 points
1,809 views
0 votes
1 answer

Error:sudo: npm: command not found

Hello @kartik, I had the same problem; here ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
12,026 views
0 votes
1 answer

Error:nvm is not compatible with the npm config "prefix" option:

Hello @kartik, After installing nvm using brew, create ~/.nvm directory: $ ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
4,249 views
0 votes
1 answer

How to include route handlers in multiple files in Express?

Hello @kartik, If you want to put the routes ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
5,544 views
0 votes
1 answer

How to paginate with Mongoose in Node.js?

Hello @kartik, You can chain just like that: var ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
568 views
0 votes
1 answer

Error:Nodejs cannot find installed module on Windows

Hello @kartik, Add an environment variable called NODE_PATH and set ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
4,489 views
0 votes
1 answer

How to npm install to a specified directory?

Hello @kartik, You can use the --prefix option: mkdir -p ./install/here/node_modules npm ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
6,857 views
0 votes
1 answer

Error:npm install won't install devDependencies

Hello @kartik, Try: npm install --only=dev If you are worried ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
6,833 views
0 votes
1 answer

How to extract request http headers from a request using NodeJS connect?

Hello @kartik, To see a list of HTTP ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
22,424 views
0 votes
1 answer

How to show the latest version of a package?

Hello @kartik, You can use: npm show {pkg} version (so npm ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
604 views
0 votes
1 answer

How to Get data from fs.readFile?

Hello @kartik, The function you have defined is ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
6,693 views
0 votes
1 answer

How to reload or re-render the entire page using AngularJS?

Hello @kartik< For the record, to force angular ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
4,702 views
0 votes
1 answer

How to stop node.js program from command line?

Hello @kartik, Ctrl+Z suspends it, which means it can ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
18,608 views
0 votes
1 answer

How to include scripts located inside the node_modules folder?

Hello @kartik, I would use the path npm ...READ MORE

Jul 15, 2020 in Node-js by Niroj
• 82,880 points
8,556 views
0 votes
1 answer

How do I URl encode something in Node.js?

Hello @kartik, The built-in module querystring is what you're looking ...READ MORE

Jul 14, 2020 in Node-js by Niroj
• 82,880 points
2,157 views
0 votes
1 answer

How do I install node-sass using VSCode?

Hello @ Ebuka, Here is the following things you ...READ MORE

Jul 14, 2020 in Node-js by Niroj
• 82,880 points
5,032 views