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
65 answers

How can I update Node.js and NPM to their latest versions?

I just installed Node.js and NPM (Node Package Manager). I installed NPM for access to additional Node.js modules. After I installed Node.js and NPM, I noticed that neither were the latest versions available. How do I upgrade Node.js, NPM, and my…
  • 21,261
  • 3
  • 16
  • 5
22 answers

How to install an npm package from GitHub directly

Trying to install modules from GitHub results in this error: ENOENT error on package.json. Easily reproduced using express: npm install throws error. npm install express works. Why can't I install from…
guy mograbi
  • 27,391
  • 16
  • 83
  • 122
38 answers

Could not find a declaration file for module 'module-name'. '/path/to/module-name.js' implicitly has an 'any' type

I read how TypeScript module resolution works. I have the following repository: @ts-stack/di. After compiling the directory structure is as follows: ├── dist │   ├── annotations.d.ts │   ├── annotations.js │   ├── index.d.ts │   ├── index.js │   ├──…
  • 27,251
  • 11
  • 40
  • 63
25 answers

How to use executables from a package installed locally in node_modules?

How do I use a local version of a module in node.js. For example, in my app, I installed coffee-script: npm install coffee-script This installs it in ./node_modules and the coffee command is in ./node_modules/.bin/coffee. Is there a way to run this…
  • 55,990
  • 32
  • 132
  • 223
18 answers

Git - Ignore node_modules folder everywhere

I have a project containing multiple other projects : Main project Mini project 1 Mini project 2 All containing node_modules folder. I want git to ignore the folder no matter where it is starting from the root folder. Something like this to…
  • 10,337
  • 8
  • 36
  • 68
32 answers

SyntaxError: Cannot use import statement outside a module

I've got an ApolloServer project that's giving me trouble, so I thought I might update it and ran into issues when using the latest Babel. My "index.js" is: require('dotenv').config() import {startServer} from './server' startServer() And when I…
  • 6,798
  • 3
  • 14
  • 19
20 answers

How to use paths in tsconfig.json?

I was reading about path-mapping in tsconfig.json and I wanted to use it to avoid using the following ugly paths: The project organization is a bit weird because we have a mono-repository that contains projects and libraries. The projects are…
Remo H. Jansen
  • 23,172
  • 11
  • 70
  • 93
22 answers

Cannot install NodeJs: /usr/bin/env: node: No such file or directory

I'm trying to install nodeJs into my Ubuntu 14.04 in order to use GruntJs. I've read about Ubuntu different way of doing it (issues?), so this is what I've done in order to install it: sudo apt-get install npm sudo npm install -g grunt-cli Typing…
  • 14,620
  • 10
  • 40
  • 70
12 answers

How to include scripts located inside the node_modules folder?

I have a question concerning best practice for including node_modules into a HTML website. Imagine I have Bootstrap inside my node_modules folder. Now for the production version of the website, how would I include the Bootstrap script and CSS files…
  • 6,093
  • 11
  • 42
  • 55
12 answers

Delete node_modules folder recursively from a specified path using command line

I have multiple npm projects saved in a local directory. Now I want to take backup of my projects without the node_modules folder, as it is taking a lot of space and can also be retrieved any time using npm install. So, what would be a solution to…
  • 3,652
  • 4
  • 13
  • 19
3 answers

What are differences between SystemJS and Webpack?

I'm creating my first Angular application and I would figure out what is the role of the module loaders. Why we need them? I tried to search and search on Google and I can't understand why we need to install one of them to run our…
  • 13,912
  • 34
  • 100
  • 166
28 answers

Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51

I am running a node application on terminal. Have recently upgraded to node v8.5.0, but am getting this error: Error: The module '/tidee/tidee-au/packages/tidee-au-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node' was compiled against a…
  • 24,754
  • 25
  • 104
  • 149
4 answers

npm: When to use `--force` and `--legacy-peer-deps`

I'm trying to understand how recreating the node_modules directory for deployment works. We're using npm ci instead of npm install to ensure a clean slate during deployment. However, when we run it without any flags, we get the following error: Fix…
Floating Sunfish
  • 4,920
  • 5
  • 29
  • 48
6 answers

Npm install failed with "cannot run in wd"

I am trying to get my node environment set up on a new Ubuntu 12.04 instance, with Node 0.8.14 already installed, but I ran into problems when I try to run npm install. So when I try npm install, it says that I need to run it as root or…
  • 3,271
  • 4
  • 19
  • 18
17 answers

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

I just want to install to my project which is located on folder. But when I run following command it shows following Warnings.And its not created a node_modules directory inside my project folder. How to fix…
2 3
99 100