Most viewed questions in Node-js

0 votes
1 answer

How to return data from Axios API?

Hello @kartik, The issue is that the original axiosTest() function ...READ MORE

Oct 13, 2020 in Node-js by Niroj
• 82,880 points
44,025 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,852 views
0 votes
1 answer

How do I test a single file using Jest?

Hii, All you have to do is chant ...READ MORE

Nov 26, 2020 in Node-js by Niroj
• 82,880 points
39,735 views
0 votes
1 answer

How to clear https proxy setting of NPM?

Hello @kartik, By running npm config rm proxy you remove ...READ MORE

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

NodeJS - What does "socket hang up" actually mean?

When a socket hang up is thrown, ...READ MORE

Jun 7, 2022 in Node-js by Neha
• 9,060 points
33,695 views
0 votes
1 answer

How to clean node_modules folder of packages that are not in package.json?

Hello @kartik, You could remove your node_modules/ folder ...READ MORE

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

How can I set NODE_ENV=production on Windows?

Hello @kartik, It would be ideal if you ...READ MORE

Jul 13, 2020 in Node-js by Niroj
• 82,880 points
29,244 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
27,195 views
0 votes
1 answer

How to force tsc to ignore node_modules folder?

Hello @kartik, Quickfix is to skip the check { ...READ MORE

Oct 14, 2020 in Node-js by Niroj
• 82,880 points
26,954 views
0 votes
1 answer

How to update a value in a json file and save it through node.js?

Hello @kartik, It's particularly useful if you're concerned ...READ MORE

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

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Niroj\package.json'

Hello @kartik, If you already have package-lock.json file just delete ...READ MORE

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

How do I redirect in expressjs while passing some context?

Hello @kartik, The easiest way I have found ...READ MORE

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

How to set environment variables from within package.json?

Hello @kartik, Set the environment variable in the ...READ MORE

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

How to fill an input field using Puppeteer?

Hello @kartik, Just set value of input like ...READ MORE

Oct 16, 2020 in Node-js by Niroj
• 82,880 points
23,123 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,386 views
0 votes
1 answer

How to restart a node.js server?

Hello @kartik, If it's just running (not a ...READ MORE

Oct 12, 2020 in Node-js by Niroj
• 82,880 points
21,826 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,460 views
+1 vote
1 answer

How to restore/reset npm configuration to default values?

Hello @kartik, To reset user defaults Run this in ...READ MORE

Oct 12, 2020 in Node-js by Niroj
• 82,880 points
18,586 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,528 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
18,023 views
0 votes
1 answer

How to completely remove node.js from Windows?

Run npm cache clean --force Uninstall from Programs & ...READ MORE

Jun 14, 2022 in Node-js by Neha
• 9,060 points
17,636 views
0 votes
2 answers

Error:'TypeError: is not a function' in Node.js

You are exporting module.exports.redir = redir; That means that ...READ MORE

Oct 21, 2020 in Node-js by anonymous
• 140 points
16,574 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,899 views
0 votes
1 answer

How to use an include with attributes with sequelize?

Hello @kartik, Something like this should work foo.findAll({ ...READ MORE

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

Error:node.js /socket.io/socket.io.js not found

Hello @kartik, Copying socket.io.js to a public folder (something as resources/js/socket.io.js) ...READ MORE

Nov 27, 2020 in Node-js by Niroj
• 82,880 points
14,023 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
14,013 views
0 votes
1 answer

How to check if a collection exists in Mongodb native nodejs driver?

Hello @kartik, The collectionNames method of the native driver's Db object accepts ...READ MORE

Nov 27, 2020 in Node-js by Niroj
• 82,880 points
13,731 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,511 views
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,349 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,172 views
0 votes
1 answer

How to read binary files byte by byte in Node.js?

Hello, Here is an example of fs.read()-ing the first ...READ MORE

Nov 27, 2020 in Node-js by Niroj
• 82,880 points
12,434 views
0 votes
1 answer

Error: Cannot find module 'mongodb'

Hello @kartik, The error you are getting indicates ...READ MORE

Oct 15, 2020 in Node-js by Niroj
• 82,880 points
12,289 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,007 views
0 votes
1 answer

How to Inject nestjs service from another module?

Hii, You have to export the ItemsService in the module that provides ...READ MORE

Nov 27, 2020 in Node-js by Niroj
• 82,880 points
11,731 views
0 votes
1 answer

How do I send command line arguments to npm script?

Hello @kartik, The syntax is as follows: npm run ...READ MORE

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

How do you run a js file using npm scripts?

Hello @kartik, Try this: { "scripts" : { ...READ MORE

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

How can I get npm start at a different directory?

Hello @kartik, Try using: npm start --prefix path/to/your/app & inside ...READ MORE

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

nodejs mysql Error: Connection lost The server closed the connection

Try to use this code to handle server disconnect: var ...READ MORE

Jun 17, 2022 in Node-js by Neha
• 9,060 points
10,322 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,980 views
0 votes
1 answer

ReferenceError: primordials is not defined in node

Hello @kartik, Use following commands and install node v11.15.0: npm ...READ MORE

Jul 12, 2020 in Node-js by Niroj
• 82,880 points
9,969 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,784 views
0 votes
1 answer

How to make login with Nodejs and MongoDB?

MongoDB Login and Registration with Node js ...READ MORE

Jun 16, 2022 in Node-js by Neha
• 9,060 points
9,696 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,592 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,312 views
0 votes
1 answer

How to Install a local module using npm?

Hello @kartik, This is what worked for me: npm ...READ MORE

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

How can I format a date coming from MongoDB?

Hello @kartik, JavaScript has built-in support for dates. ...READ MORE

Nov 30, 2020 in Node-js by Niroj
• 82,880 points
8,810 views
0 votes
1 answer

How to write a test which expects an Error to be thrown in Jasmine?

Hello @kartik, Try using an anonymous function instead: expect( ...READ MORE

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

npm dotenv environment variables not recognized in nodejs module

process.env object that are defined in the ...READ MORE

Jun 10, 2022 in Node-js by Neha
• 9,060 points
8,715 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,538 views
0 votes
1 answer

How to provide a mysql database connection in single file in nodejs?

Hello @kartik, You could create a db wrapper ...READ MORE

Oct 15, 2020 in Node-js by Niroj
• 82,880 points
8,477 views