Latest questions in Node-js

0 votes
1 answer

How to Pass route control with optional parameter after root in express?

Hello @kartik, That would work depending on what ...READ MORE

Oct 12, 2020 in Node-js by Niroj
• 82,880 points
13,207 views
0 votes
1 answer

How npm start runs a server on port 8000?

Hello @kartik, If you will look at package.json file. you will ...READ MORE

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

How to create an Excel File with Nodejs?

Hello @kartik, Just create a file with Tabs ...READ MORE

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

Error: Cannot find module 'ejs'

Hello @kartik, Go up one level (above app.js) ...READ MORE

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

Error:Cannot find module 'xmlhttprequest'

Hello @kartik, XMLHttpRequest is a built-in object in web ...READ MORE

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

Error:npm-cli.js not found when running npm

Hello @kartik, You need to run this in ...READ MORE

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

How to create .pem files for https web server?

Hello @kartik, The two files you need are ...READ MORE

Sep 7, 2020 in Node-js by Niroj
• 82,880 points
3,027 views
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
26,973 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,033 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
829 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,071 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
424 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
573 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
485 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,472 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
530 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
451 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,068 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
633 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
461 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,673 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,571 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,373 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,019 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,351 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,225 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
4,976 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,682 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
9,907 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,526 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
559 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,737 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,831 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,720 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
681 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,547 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,193 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
492 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,629 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,817 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,328 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,770 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
11,922 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,165 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,506 views
0 votes
2 answers

Error:npm UNMET PEER DEPENDENCY warning

Finding the compatible versions of related packages ...READ MORE

Aug 13, 2020 in Node-js by anonymous
• 140 points
13,859 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
532 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,435 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,738 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,792 views