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
1 answer

Get file path of imported module

I'm writing a class decorator for my controllers. It looks like: export function Controller (ctor: T) { return class extends ctor { public readonly name = name; } } ctor is a constructor of a…
Forseti
  • 2,587
  • 6
  • 21
  • 32
2
votes
1 answer

How to export function?

I'm trying to export this function to another file. But It doesn't work properly. Just want to make sure am I doing everything right? window.colorAddElement = addedElements => { const addedElementsDOMNode = document.getElementById( …
Yerlan Yeszhanov
  • 2,149
  • 12
  • 37
  • 67
2
votes
1 answer

webpack not able to bundle files when tsc is

I'm having some trouble getting webpack to build my files. it just spits a bunch of errors, all of the same form, saying: ERROR in ./node_modules/typescript-rest/dist/server.js Module not found: Error: Can't resolve 'typescript-ioc/es6' in…
Jack Bliss
  • 114
  • 6
2
votes
2 answers

Multiple module.exports for NodeJS

I was trying to add two module.exports in my NodeJS module. I tried below code for my module: exports.one = function(data){ const one = data; }; module.exports = function(msg) { console.log(one+'::'+msg); }; And below code for index.js:…
NodeDev
  • 43
  • 1
  • 7
2
votes
0 answers

Error when running 'npm start'

This has been a consistent problem for me when running 'npm start' regardless of what framework I am working in. This is my output when I run 'npm start' on my local machine.…
chody
  • 189
  • 1
  • 1
  • 10
2
votes
2 answers

how to get the node_modules folder in an aws lambda function

So I am learning how to create alexa skills and I have create two sucessfully following the steps below but for some reason when I follow these steps now I am missing the node_modules folder and the package.json. This is causing the following error…
Kris
  • 327
  • 5
  • 16
2
votes
1 answer

found 40 vulnerabilities (7 low, 31 moderate, 1 high, 1 critical)

I am getting following error while running npm uninstall... Can anyone please help to resolve... I have done almost everything to fix this... npm WARN react-star-rating-component@1.4.1 requires a peer of react@^16.2.0 but none is installed. You must…
Ashwini singh
  • 51
  • 1
  • 7
2
votes
2 answers

Add auth token in request header in ember-file-upload

I am using ember vesrion 2.15.1 for my application. I am using ember-file-upload node module to support file upload and that is successful. Challenge is I am not able to add auth token to the request header. My request header looks like this: I am…
Anand Gupta
  • 5,640
  • 3
  • 27
  • 37
2
votes
1 answer

How to create a Netlify Deploy Preview with cache clear?

With my Netlify site I can manually choose to trigger a deployment on my master branch and opt to clear the cache. However I cannot find a way of doing this with my Deploy Preview branch. I have made an npm package version change and Deploy Preview…
Curtis
  • 101,612
  • 66
  • 270
  • 352
2
votes
1 answer

ES6/TypeScript import and Angular

There's something I'm not sure to understand with ES6 module import and Angular (although it's not restrcited to Angular) When I'm importing a component like this : import { Component } from '@angular/core'; Ok I'm importing the Component class…
AntonBoarf
  • 1,239
  • 15
  • 31
2
votes
0 answers

NPM Install node not creating node_modules in current directory

Using nvm for a specific project node 6.5.0 npm 6.1.0 package.json already does exist in local directory When I am in the current directory for my project I run npm install and see it added one package from one contributor current directory npm…
2
votes
1 answer

nodeSSPI authentication issue from REST Client POSTMan

I am using nodeSSPI module to authenticate my node js application and it works fine as long as the request is from the browser but when I try to request i.e. GET,POST etc. from POST Man Client it always returns 401 Unauthorized I dont fully…
Nick Div
  • 5,338
  • 12
  • 65
  • 127
2
votes
1 answer

Can Tedious connection and request event listeners be put in a separate module for Node.js?

This is my first ever question on here so please excuse any abnormalities in etiquette. I am new to Node.js and backend programming in general. Right now I am using Node and Tedious to connect to a local SQL server. I'd like to keep my main.js file…
Mario Gju
  • 23
  • 3
2
votes
1 answer

Include file from node_modules to nyc

I want to use nyc to generate code-coverage. I am building some of my projects into node_modules to use them in other projects. When writing tests I want to test the files inside node_modules and therefore I want to include files from…
Robert K
  • 21
  • 4
2
votes
2 answers

Cannot find module 'path' in program.d.ts

When running ng serve my code fails to compile and gives me this error: ERROR in node_modules/@angular/compiler-cli/src/transformers/program.d.ts(9,23): error TS2307: Cannot find module 'path'. I thought that it had something to do with that my…
Christof Nies
  • 21
  • 1
  • 6