Questions tagged [node-modules]

Node.js has a simple module loading system that reduces complexity of applications and promotes code reusability.

Node.js has a simple module loading system that reduces complexity of applications and promotes code reusability. In Node.js, files and modules are in one-to-one correspondence.

For example, foo.js loads the module circle.js in the same directory:

The contents of foo.js:

var circle = require('./circle.js');
console.log( 'The area of a circle of radius 4 is ' + circle.area(4));

The contents of circle.js:

var PI = Math.PI;

exports.area = function (r) {
  return PI * r * r;
};

exports.circumference = function (r) {
  return 2 * PI * r;
};

Node.js also has an incredible community of open source developers who publish packages using :

6621 questions
2
votes
0 answers

How node handles multiple blocking I/O request when the number of requests is more than the internal thread pool

So, below is my understanding of node.js. Please correct me if I am missing anything here. Each incoming request will be stored in an event queue first. Event loop will be serving requests from event queue. Non blocking request will be directly…
2
votes
1 answer

Named exports/ imports vs imports with absolute path

I am implementing a component library (an npm module and we'll call it awesome-components) which consists of buttons, inputs, dropdowns etc. where an end user can install it in thier react app and use these components. My confusion is what is the…
Hasitha Shan
  • 2,900
  • 6
  • 42
  • 83
2
votes
3 answers

Npm pack to include local modules

I have some local modules that I want to include in my package to be sent to a server. Since these local packages are not on the npm registry, they need to be part of the package. I have tried some ways to get the node_modules folder included in the…
Bastiaan
  • 686
  • 1
  • 8
  • 20
2
votes
0 answers

Ejected Create-React-App unable to transpile node_modules code from Atlaskit packages

Atlaskit packages in node_modules are causing Jest to fail in ejected create-react-app. I only have the default App.test.js file so far and receive a SyntaxError: Unexpected token export from @atlaskit/dropdown-menu. Image of Error I have looked all…
SavSamoylov
  • 65
  • 1
  • 2
  • 7
2
votes
0 answers

How can I run the grunt file in watch mode and also enable live reloading?

require( 'time-grunt' )( grunt ); require( 'load-grunt-tasks' )( grunt…
2
votes
2 answers

Managing package.json & package-lock.json with Git

I know you're supposed to add package-lock.json to your git repo to ensure team members are using the same versions of dependencies. Running npm install will check for a package-lock.json and install the versions indicated there. If a lock file is…
yevg
  • 1,846
  • 9
  • 34
  • 70
2
votes
1 answer

npm run install with --prefix creates 'etc' folder

In package.json (let's say it's defined in Scripts folder) I have script defined like this: "scripts": { "install:prod": "npm i" } If i run this script from Scripts folder everything is correct, only node_modules is created . But when I run…
2
votes
1 answer

Node.js module.exports a function with input

I have a little encryption file that adds a encrypted random number after some inputs: const crypto = require("crypto"); module.exports = function (x, y) { crypto.randomBytes(5, async function(err, data) { var addition = await…
Chen
  • 860
  • 10
  • 32
2
votes
1 answer

How to give a custom url in package.json for a package

I have done customization in a npm package inside node_modules folder. Now I want to deploy it on heroku. But what heroku does is It will see the package.json and install the fresh package. So someone suggested me to provide the custom url for a npm…
Rajat
  • 486
  • 1
  • 10
  • 35
2
votes
2 answers

While running ReactiNative project index.js not found error occur

I am new to ReactNative I am facing one issue. Please check below log for same. I am facing this issue when trying to run ReactNative project using react-native run-android Error Log: Error: Unable to resolve module ./index from…
Lokesh Desai
  • 2,607
  • 16
  • 28
2
votes
3 answers

How to push changes in package.json of kentico-cloud-delivery of node_modules into bitbucket

According to the Kentico technical support adviser, in order to get my create-react-app application rendered on IE11, I had to change the following line of code inside the node_modules -> kentico-cloud-delivery -> package.json file: "main":…
2
votes
0 answers

Is there any way to speed up removing /moving the node modules?

I'm having quite a struggle with moving and deleting the node modules folder or should I say the whole project itself and it took pretty much around half an hour just for 2 projects or so. Not really sure if it's OS specific or processor specific…
NeonNatureEX
  • 487
  • 3
  • 17
2
votes
0 answers

How to build native nodejs modules for launchui?

I'm building an app using proton-native. it uses native modules written in C++, for example, keytar. Proton-native uses a tool named launchui to package nodejs app as an executable. It's basically simple wrapper for nodejs with the following…
Yuri Kriachko
  • 294
  • 1
  • 13
2
votes
0 answers

why @angular-devkit/build-angular doesn't install webpack?

I have added latest version of @angular-devkit/build-angular in package.json and did npm install ,it should install webpack as well ,as a peer dependency but its not installing ,its throwing a warning explicitly to install webpack when I do npm…
2
votes
1 answer

ReactJS - MaskedInput adds extra spaces when dealing with Zip code masked input

I have the following code: import React from "react"; import ReactDOM from "react-dom"; import MaskedInput from "react-text-mask"; import "./styles.scss"; class App extends React.Component { constructor(props) { super(props); this.state…
Viewsonic
  • 827
  • 2
  • 15
  • 34