Skip to main content

Questions tagged [node-modules]

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

node-modules
Filter by
Sorted by
Tagged with
2171 votes
67 answers
2.4m views

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

I just installed Node.js and npm. 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. So my ...
Dail's user avatar
  • 21.9k
1228 votes
24 answers
862k views

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 https://github.com/visionmedia/express throws error. npm ...
guy mograbi's user avatar
  • 28.3k
1069 votes
40 answers
1.7m views

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 │   ├── ...
ktretyak's user avatar
  • 30.5k
742 votes
26 answers
482k views

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 ./...
typeoneerror's user avatar
  • 56.6k
680 votes
18 answers
1.1m views

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 ...
Mehdiway's user avatar
  • 10.5k
675 votes
33 answers
1.8m views

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 ...
user3810626's user avatar
  • 7,389
406 votes
20 answers
501k views

How can I use paths in tsconfig.json?

I was reading about path-mapping in file 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 ...
Remo H. Jansen's user avatar
367 votes
22 answers
383k views

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 ...
Rosamunda's user avatar
  • 14.9k
355 votes
12 answers
272k views

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 ...
Chris's user avatar
  • 6,203
349 votes
14 answers
135k views

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 ...
Sumit's user avatar
  • 4,022
243 votes
5 answers
416k views

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 ...
Floating Sunfish's user avatar
236 votes
3 answers
103k views

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 ...
smartmouse's user avatar
  • 14.2k
228 votes
28 answers
291k views

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/...
JoeTidee's user avatar
  • 25.7k
206 votes
22 answers
66k views

Appending .js extension on relative import statements during Typescript compilation (ES6 modules)

This seems to be a trivial problem, but it is not very obvious what settings/configurations need to be used to solve this issue. Here are the Hello World program directory structure and the source ...
user3330840's user avatar
  • 7,175
205 votes
6 answers
136k views

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 ...
E.H.'s user avatar
  • 3,381
186 votes
17 answers
655k views

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

I just want to install socket.io to my project which is located on 3.chat folder. But when I run following command it shows following Warnings.And its not created a node_modules directory inside my ...
user avatar
178 votes
27 answers
209k views

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in the package.json of a module in node_modules

This is a React web app. When I run npm start This error occurred > [email protected] start > react-scripts start node:internal/modules/cjs/loader:488 throw e; ^ Error [...
Julian Chu's user avatar
  • 1,990
178 votes
17 answers
111k views

How to npm publish specific folder but as package root

I have a project that include a gulp task for building and packaging the sources and release in a directory called dist. My goal is publish it as a npm package, but only my dist folder. The npm ...
robsonrosa's user avatar
  • 2,658
163 votes
11 answers
105k views

How to fix 'fs: re-evaluating native module sources is not supported' - graceful-fs

Recently I've made a switch to Node v.6, and It started creating more and more problems with running normal builds grunt/gulp/webpack For example: $ gulp [14:02:20] Local gulp not found in ~/_Other/...
shershen's user avatar
  • 9,925
163 votes
6 answers
785k views

Javascript require() function giving ReferenceError: require is not defined

Basically, I am using javascript to scrape data from Google Play store using: 1-Request 2-Cheerios 3-QueryString I used Google Market API from Github which uses require as following: var request = ...
Hunain Usman's user avatar
  • 2,178
153 votes
12 answers
109k views

An unhandled exception occurred: Job name "..getProjectMetadata" does not exist

When I start to run my Application, I get this error: **[error] Error: Job name "..getProjectMetadata" does not exist.** at Observable._subscribe (/Users/vasil/KSS/kssfrontend/node_modules/@...
vasil001's user avatar
  • 2,671
143 votes
10 answers
149k views

Remove node_modules from git in vscode

Getting error while removing node_modules in git, vscode terminal git rm -r --cached node_modules Error: fatal error: pathspec 'node_modules' did not match any files
Manoj's user avatar
  • 2,178
141 votes
17 answers
99k views

NPM modules won't install globally without sudo

I have just reinstalled Ubuntu 12.04 LTS, and before anything else i did these steps: Installed Node via package manager with the following script sudo apt-get update sudo apt-get install python-...
HeberLZ's user avatar
  • 13.7k
137 votes
3 answers
86k views

When installing packages with Yarn, what does "incorrect peer dependency" mean?

I've just cloned a repo, which recommends the use of Yarn to install dependencies. When I run yarn install, it seems to be okay, but it provides this warning: yarn install v0.20.3 [1/4] 🔍 Resolving ...
shrewdbeans's user avatar
  • 12.3k
136 votes
20 answers
205k views

NPM - Failed to replace env in config: ${NPM_TOKEN}

I am trying to build a react app, but when I execute the command npm -i it gives me the following error: Error: Failed to replace env in config: ${NPM_TOKEN} at /usr/local/lib/node_modules/npm/...
funtik's user avatar
  • 1,756
115 votes
11 answers
35k views

How to test dockerignore file?

After reading the .dockerignore documentation, I'm wondering if there is a way to test it? Examples **/node_modules/ How do I check my dockerfile ignore the correct files and directories?
Édouard Lopez's user avatar
113 votes
14 answers
124k views

Install node_modules inside Docker container and synchronize them with host

I have the problem with installing node_modules inside the Docker container and synchronize them with the host. My Docker's version is 18.03.1-ce, build 9ee9f40 and Docker Compose's version is 1.21.2,...
Vlad Turak's user avatar
  • 6,224
110 votes
9 answers
98k views

Missing write access in mac to /usr/local/lib/node_modules

I am trying to install angular cli but it's show me Missing write access to /usr/local/lib/node_modules so, how can I fix it in my mac i try it may time but, not getting exact answer npm WARN ...
Kundan Kumar Mourya's user avatar
109 votes
15 answers
191k views

Webpack: Bundle.js - Uncaught ReferenceError: process is not defined

Here's my webpack.config.js "use strict"; module.exports = { entry: ['./main.js'], output: { path: __dirname, filename: 'bundle.js' }, module: { loaders: [ { ...
cbll's user avatar
  • 6,979
93 votes
14 answers
263k views

npm install doesn't create node_modules directory

I am trying to do a homework for a mongodb uni course. They gave us some files, instructions are: run npm install mongodb then node app.js for some reason npm install does not create a node_modules ...
Connor Leech's user avatar
  • 18.6k
90 votes
18 answers
311k views

Error message "node: --openssl-legacy-provider is not allowed in NODE_OPTIONS"

This problem appeared after an update, sudo apt upgrade, on Ubuntu 20.04 (Focal Fossa). Previously, I worked on versions Node.js v18.0.0 and npm 8.7.0, but after the update there was a problem. I ran ...
loki's user avatar
  • 1,015
86 votes
3 answers
150k views

Top-level ‘await’ expressions are only allowed when the ‘module’ option is set to ‘esnext'

I am going through Stripes integration steps and have come across an error for my code found in step 2.1 (https://stripe.com/docs/connect/collect-then-transfer-guide#create-an-account-link) How do I ...
Kev Wats's user avatar
  • 1,156
82 votes
11 answers
107k views

How to install Angular CLI locally (without the -g flag)

I've just started working with Angular and with Angular-CLI and I've seen that, according to the documentation, I need to install $ npm install -g @angular/cli with the -g (global) flag. However I ...
Gil Epshtain's user avatar
  • 9,465
79 votes
3 answers
97k views

Remove everything after last backslash

var t = "\some\route\here" I need "\some\route" from it. Thank you.
InGeek's user avatar
  • 2,622
78 votes
8 answers
124k views

How to install node.tar.xz file in linux

I recently downloaded the Nodejs file from the official site and I don't know how to install the Nodejs from a archived file. Please help me how can I install this file so that I can run the "npm&...
Learn More's user avatar
  • 1,055
77 votes
10 answers
198k views

Cannot find the '@angular/common/http' module

I am following this fundamental tutorial on Angular about Http. As one can see in the "Setup: Installing the module" section, they import the HttpClientModule as follow: import {HttpClientModule} ...
monstertjie_za's user avatar
71 votes
11 answers
87k views

Error: Rule can only have one resource source (provided resource and test + include + exclude)

hello I have the following error, I have an app in vuejs, it was working fine, the error appeared suddenly, reinstalled everything, clean cache and I can't find a way to solve it, I hope your help ...
Juan Pablo Gomez Zapata's user avatar
67 votes
8 answers
91k views

npm ERR! Unsupported URL Type "workspace:": workspace:*

I'm creating a new project with gatsby gatsby new YourProjectName2 https://github.com/Vagr9K/gatsby-advanced-starter and get an error: info Creating new site from git: https://github.com/Vagr9K/gatsby-...
pcatre's user avatar
  • 1,614
66 votes
11 answers
113k views

Sass Loader Error: Invalid options object that does not match the API schema

I'm using VueJS with the framework VuetifyJS (v2.0.19). I'm getting this error after running npm run serve: Sass Loader has been initialised using an options object that does not match the API ...
Tom's user avatar
  • 5,852
65 votes
6 answers
82k views

node --experimental-modules, requested module does not provide an export named

I've installed Node 8.9.1 (same problem happens in v10.5.0). I'm trying to use named imports from npm packages in a file with the .mjs import { throttle } from lodash; I run: node --experimental-...
stackdave's user avatar
  • 6,895
63 votes
8 answers
128k views

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

I need to provide the mysql connection for modules. I have a code like this. var express = require('express'), app = express(), server = require('http').createServer(app); var mysql = require('...
user3836476's user avatar
  • 1,115
59 votes
3 answers
83k views

Best node.js module for finding location? [closed]

I had found couple of node.js modules for finding the information about client location and network using ip address. Requirements: Location - country, city, state, latitude, longitude etc. Network -...
karthick's user avatar
  • 6,118
58 votes
8 answers
52k views

How to use ESM tests with jest?

My setup Node v14.16.0 I have one test file that contains a simple test written with ESM modules (import). In package.json I have a script (following Jest documentation adapted to Windows): "...
Luke's user avatar
  • 19.7k
57 votes
11 answers
44k views

gulp task issue with nodejs v10.3.0 : src\node_contextify.cc:629: Assertion `args[1]->IsString()' failed

I recently updated my nodejs version to 10.30.0. Everything works fine. But my gulp build task not working which was working fine on older version(9.X). This is what I am getting. gulp[11376]: src\...
M14's user avatar
  • 1,790
57 votes
1 answer
33k views

How does NPM handle version conflicts?

Since NPM version 3 node modules and dependencies are all installed at the same root level. But what if I install two modules that depend on two different versions of the same module? For instance, if ...
jwerre's user avatar
  • 9,464
56 votes
6 answers
107k views

Cannot find module "tslib"

I am experiencing this issue and don't seem to have any answer so far. Although I see tslib in my node_modules folder. Appreciate if anyone can help identify whats wrong with my code. I have seen ...
Sri Sris's user avatar
  • 2,021
56 votes
15 answers
416k views

What could cause an error related to npm not being able to find a file? No contents in my node_modules subfolder. Why is that?

I'm trying to run npm install in the angular project folder I got from ASP.NET Boilerplate and I'm getting an error that is "related to npm not being able to find a file." D:\Dev\...
jlavallet's user avatar
  • 1,337
55 votes
7 answers
61k views

Importing Sass through npm

Currently in our Sass files we have something like the following: @import "../../node_modules/some-module/sass/app"; This is bad, because we're not actually sure of the path: it could be ../...
callumacrae's user avatar
  • 8,393
55 votes
3 answers
49k views

how to use async await with https post request

I am finding way out to use async / await with https post. Please help me out. I have posted my https post code snippet below.how do I use async await with this. const https = require('https') ...
Dhiraj Bastwade's user avatar
53 votes
1 answer
9k views

Why does a module level return statement work in Node.js?

When I was answering another question I came across a Node.js module with a top-level return statement. For example: console.log("Trying to reach"); return; console.log("dead code")...
thefourtheye's user avatar

1
2 3 4 5
135