Skip to main content

All Questions

Tagged with
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
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
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
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
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
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
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
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
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
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
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
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
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
46 votes
2 answers
87k views

What is the purpose of the 'node_modules' folder?

What exactly is the node_modules folder and what is it for? I know when we download any library with npm, the library goes to folder node_modules. I also know that, when we are going to upload it (to ...
izaac mendes's user avatar
40 votes
2 answers
18k views

Require dependency of another dependency in node modules

I've got a simple node app that has single dependency on another app on github. The dependency installs just fine with npm install, but when I try to require something installed there, it says it's ...
typeoneerror's user avatar
  • 56.6k
37 votes
4 answers
24k views

How to prevent nested node_modules inside node_modules

I've created my own npm package, let's call it XYZ, it has @material-ui dependency in it's package.json file. When I install it in project A I have nested node_modules inside of XYZ folder(so it's A\...
Jac Mos's user avatar
  • 8,646
36 votes
13 answers
228k views

npm ERR! 404 Not Found - GET https://registry.npmjs.org/error-ex [closed]

I am trying to install npm package dependencies in to my angular application and i am getting this error. Any help to fix this? npm ERR! code E404 npm ERR! 404 Not Found: error-ex@^1.2.0 npm ERR! A ...
Dilushika Weerawardhana's user avatar
34 votes
12 answers
98k views

can't Resolve rxjs

Failed to compile. ./src/app/hero.service.ts Module not found: Error: Can't resolve 'rxjs/Observable/of' in 'C:\Users\Admin\angular\myheroes\src\app' @ ./src/app/hero.service.ts 13:11-40 @ ./...
Bhavin's user avatar
  • 473
34 votes
2 answers
156k views

What Are "npm run dev" and "npm run prod"

I use the following command to bundle my scripts via the Laravel Mix module: npm run dev // Compile scripts. npm run prod // Compile and minify scripts. Are these native npm commands or custom ...
GTS Joe's user avatar
  • 3,952
32 votes
3 answers
55k views

How to update package.json to latest version of each package?

Before you flag it as duplicate, I have searched for the similar questions and none of them helped me. Currently this is what I have tried: Delete package-lock.json file. Delete node_modules. Run npm ...
Samson's user avatar
  • 1,708
30 votes
9 answers
100k views

Error: error:0308010C:digital envelope routines::unsupported [ANGULAR]

I was trying to build my project on jenkins. The local build is successful but Jenkins build is failing. Any fix for this? I am using primeng module to implement p-organisationchart. I suspect that ...
Arjun C E's user avatar
  • 431
30 votes
5 answers
34k views

How do I install a package with npm with a different/custom module name

I want to install a specific revision from a github tarball named something like "mymodule" and name it something like "mymoduleTemp", and then load a potentially different version of it that will ...
B T's user avatar
  • 59.8k
28 votes
3 answers
28k views

what is passport.initialize()? (nodejs express)

I'm now trying to apply passport module in my apps. I'm reading some manuals, and there say, app.use(passport.initialize()); app.use(passport.session()); what is app.use(passport.initialize()) ...
jwkoo's user avatar
  • 2,613
26 votes
3 answers
79k views

How can I update all Node.js modules automatically?

During my work with the Node.js environment, I faced the issue of version maintenance of Node.js modules. I would like to be sure that all internal Node.js modules are updated. Many of existing ...
Mike's user avatar
  • 14.4k
26 votes
9 answers
14k views

How can we trust npm modules?

I'm using many Node.js modules through npm package manager. Since these modules are not developed by trusted organisations, are they trustworthy? I don't know whether the npm team is doing any ...
sijo vijayan's user avatar
  • 1,700
25 votes
10 answers
40k views

Node error Cannot read property 'resolve' of undefined

I am using reactjs and am unable to install any packages using npm install. The error message I'm getting is : npm ERR! Cannot read property 'resolve' of undefined npm ERR! A complete log of this ...
user avatar
25 votes
4 answers
107k views

Could not determine the dependencies of task ':app:mergeDebugAssets'

When I run react-native run-android on my project,I get an build error of gradle. I already uninstalled react-native-ftp with npm uninstall --save react-native-ftp, removed that dependency of ...
Leonardo Torres's user avatar
25 votes
1 answer
16k views

"style" field in package.json

I noticed that Bootstrap and Normalize.css both have a "style" field in their package.json. Why do they have this? If I had to guess, it's to allow users to import the defined stylesheet as easily as ...
banhfun's user avatar
  • 297
24 votes
1 answer
35k views

how to import all css of node_modules in vuejs

I am building a Vue.js app starting with the webpack template and vuetify. To import vuetify css Im doing this in my App.vue <style> @import '../node_modules/vuetify/dist/vuetify.min.css' &...
Diego Manjarrés's user avatar
24 votes
2 answers
30k views

Module is extraneous npm

I've checked that the connect-privkey-to-provider module is in the dependencies. However, it keeps saying Module 'connect-privkey-to-provider' is extraneous npm and cannot find module 'connect-privkey-...
1Sun's user avatar
  • 2,335
22 votes
4 answers
38k views

npm install returns syscall spawn git error

I've tried to run npm install and faced these issues below I've tried to clear cache with force command, install git and update node but nothing worked here is the error npm ERR! code ENOENT npm ...
Chaitwo's user avatar
  • 259
22 votes
3 answers
22k views

How to run a post-install script after individual execution of "npm install <package>"

I am maintaining the following directory structure: /home/user/Desktop/ |-- app/ | |-- package.json | `-- server.js |-- ...
dibyendu's user avatar
  • 525
21 votes
2 answers
16k views

How to view node_modules dependency tree?

How do I view the dependency graph of a npm-based project? I tried Madge but it ignores node_modules.
Qwertie's user avatar
  • 16.9k
21 votes
2 answers
13k views

How to choose 'module' instead of 'main' file in package.json

I have created some npm modules and compile them to: commonJS (using exports.default =) and esm (using export default) I set up my package.json like so: main: "index.cjs.js", module: "index.esm.js" ...
mesqueeb's user avatar
  • 5,998
20 votes
2 answers
28k views

`Cannot find module` for my own TypeScript module

I have just published a new TypeScript-based module to the NPM registry. However, when I try to install it and import it in another TypeScript project, VSCode gives me the following error on the ...
anon's user avatar
  • 1
20 votes
5 answers
3k views

How do node_modules packages read config files in the project root?

I am creating an npm package that needs to be able to read config files from the project root. I'm not sure how to do this. For example, Next.js is able to read ./pages/ and ./next.config.js from ...
Jake's user avatar
  • 4,155
20 votes
3 answers
4k views

How to remove the output folder from the import statements for my package users?

I have a Typescript-based project with multiple .d.ts files that I want to export as npm package and use in another project. In that other project, I want to be able to call: import {Foo} from "@my-...
Robin's user avatar
  • 36.6k
20 votes
3 answers
23k views

Is there an npm module to modify a pdf file in node.js?

I'm building a node.js app on Bluemix that should take a pdf file as request and then grey out (blank) some part of the pdf file. And also here the pdf file is the same for all, and the area we need ...
H Varma's user avatar
  • 610
19 votes
4 answers
33k views

Getting "npm ERR! code EPEERINVALID" on npm packages global install

Whenever I am installing any global package I am getting this error. Error:- on npm packages global install For example:- robins@robins-H61MLV3:~$ sudo npm install -g jshint /usr/bin/jshint -&...
Robins Gupta's user avatar
  • 3,153
18 votes
1 answer
25k views

Restoring node-modules and bower_components based on script contents

How do I restore node-modules and bower_components? I want to source control files which are actually part of my application and not the dependencies. I want to restore those dependencies after I ...
Ian CT's user avatar
  • 1,391

1
2 3 4 5
33