Trending questions in Node-js

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,506 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,471 views
0 votes
1 answer

How to run shell script file using nodejs?

Hello @kartik, You could use "child process" module ...READ MORE

Oct 16, 2020 in Node-js by Niroj
• 82,880 points
8,433 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,457 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,752 views
0 votes
1 answer

Error: jQuery requires a window with a document

Hello @kartik, Try this: // definition var $ = require('jquery')(require("jsdom").jsdom().parentWindow); // ...READ MORE

Oct 16, 2020 in Node-js by Niroj
• 82,880 points
8,061 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,986 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,562 views
0 votes
1 answer

How to find the version of an installed node.js/npm package?

Hello, npm view <package> version - returns the latest ...READ MORE

Nov 24, 2020 in Node-js by Niroj
• 82,880 points
6,126 views
0 votes
1 answer

How do I perform an id array query in Mongoose?

Hello @kartik, Here is a mongoosey way to ...READ MORE

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

Error:node' is not recognized as an internal or external command

Hello @kartik, Node is missing from the SYSTEM ...READ MORE

Oct 15, 2020 in Node-js by Niroj
• 82,880 points
7,552 views
0 votes
1 answer

How to set the content-type of request header when using Fetch APi?

Hello @kartik, You need to create a fetch ...READ MORE

Oct 15, 2020 in Node-js by Niroj
• 82,880 points
7,270 views
0 votes
1 answer

How to create package.json from package-lock.json?

Hello @kartik, Install the latest npm with npm install ...READ MORE

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

How to get Node.JS Express to listen only on localhost?

Hello @kartik, This is a bug in hive-go that only ...READ MORE

Oct 16, 2020 in Node-js by Niroj
• 82,880 points
6,671 views
0 votes
1 answer

How to catch exception in node during JSON.parse?

Hello, JSON.parse runs synchronous and does not know anything ...READ MORE

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

How to hide password in the nodejs console?

Hello @kartik, To hide your password input, you ...READ MORE

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

Error:/usr/bin/env: node: No such file or directory

Hello @kartik, You have to manually link to ...READ MORE

Oct 12, 2020 in Node-js by Niroj
• 82,880 points
6,635 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,679 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,434 views
0 votes
1 answer

How do I create a HTTP Client Request with a cookie?

Hello @kartik, The use of http.createClient is now deprecated. You ...READ MORE

Oct 16, 2020 in Node-js by Niroj
• 82,880 points
6,293 views
0 votes
1 answer

How to get data out of a Node.js http get request?

Hello @kartik, Your logs return undefined : you log before ...READ MORE

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

How to end an express.js / node POST response?

Hello @kartik, You can use res.end and pass in a ...READ MORE

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

Error:Missing file extension "ts" for "./lib/env" import/extensions

Hello @kartik, Add the following code to rules: "rules": { ...READ MORE

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

Error:Failed to parse json-This is not a bug in npm.

Hello @kartik, Try this: npm cache clean Hope it works!! Thank ...READ MORE

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

How to disconnect from tcp socket in NodeJs?

Hello, Try this out: net.createConnection() returns a Socket object. client.destroy() is what ...READ MORE

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

How to console.log to stdout on gulp events?

Hello @kartik, Use this: var gulp = require("gulp"); var util ...READ MORE

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

How to send JavaScript Object with Socket.io from server to client?

Hello @kartik, You actually need to emit an ...READ MORE

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

How to Start another node application using node.js?

Hello @kartik, Use child_process.fork(). It is similar to spawn(), but ...READ MORE

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

Error: listen EACCES 0.0.0.0:80 OSx Node.js

Hello @kartik, Give root access to node and ...READ MORE

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

How to setup route for websocket server in express?

Hello @kartik, You'll want to use the path option: var wss ...READ MORE

Oct 16, 2020 in Node-js by Niroj
• 82,880 points
5,021 views
0 votes
1 answer

Error:'bower' is not recognized as an internal or external command, operable program or batch file

Hello @kartik, Fixed it by adding the 'npm' ...READ MORE

Oct 14, 2020 in Node-js by Niroj
• 82,880 points
4,869 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,450 views
0 votes
1 answer

How to get the npm global path prefix?

Hello @kartik, Try this: npm config get prefix will return ...READ MORE

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

How to automatic run gulp tasks via npm?

Hello @kartik, Here is the code: var ...READ MORE

Nov 30, 2020 in Node-js by Niroj
• 82,880 points
2,748 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,696 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,792 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,529 views
0 votes
1 answer

How to create a pair private/public keys using Node.js crypto?

Hello @kartik, nodejs v10.12 now supports this natively ...READ MORE

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

How node.js require all files in a folder?

Hello @kartik, When require is given the path ...READ MORE

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

How to “Ping” from a Node.js app?

Hello @kartik, You could use exec to call the system ...READ MORE

Oct 16, 2020 in Node-js by Niroj
• 82,880 points
4,299 views
0 votes
1 answer

How do I define methods in a Mongoose model?

Hello @kartik, You didn't specify whether you were ...READ MORE

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

How to get path from the request in nodejs?

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

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

How to break _.forEach in lodash?

Hello @kartik, To finish lodash#forEach method use return false; statement: _.forEach(oIncludedFileMap, function(aIncludedFiles, sKey) ...READ MORE

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

How can I get the browser language in node.js?

Hello @kartik, You can use req.headers["accept-language"] to get the language/locale ...READ MORE

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

How to use the middleware to check the authorization before entering each route in express?

Hello @kartik, As long as app.use(authChecker); is before app.use(app.router); it will get ...READ MORE

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

How to update each dependency in package.json to the latest version?

Hello @kartik, npm-check-updates is a utility that automatically adjusts ...READ MORE

Nov 24, 2020 in Node-js by Niroj
• 82,880 points
1,826 views
0 votes
1 answer

Error:FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Hello @kartik, You can launch NPM using : node ...READ MORE

Nov 27, 2020 in Node-js by Niroj
• 82,880 points
1,702 views