Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
3015 votes
32 answers
2.2m views

Find the version of an installed npm package

How can I find the version of an installed Node.js or npm package? This prints the version of npm itself: npm -v <package-name> This prints a cryptic error: npm version <package-name> ...
Laurent Couvidou's user avatar
1268 votes
18 answers
513k views

What is the difference between --save and --save-dev?

What is the difference between: npm install [package_name] and: npm install [package_name] --save and: npm install [package_name] --save-dev What does this mean? And what is really the effect of --...
nfort's user avatar
  • 12.8k
1044 votes
19 answers
773k views

How to list npm user-installed packages?

How do I list the user-installed / environment package only in npm? When I do npm -g list, it outputs every package and their dependencies. Instead I'd like to see the packages installed in the ...
lolski's user avatar
  • 17k
782 votes
8 answers
578k views

How can I specify the required Node.js version in package.json?

I have a Node.js project that requires Node version 12 or higher. Is there a way to specify this in the packages.json file, so that the installer will automatically check and inform the users if they ...
Erel Segal-Halevi's user avatar
679 votes
11 answers
571k views

Installing a local module using npm?

I have a downloaded module repo, I want to install it locally, not globally in another directory? What is an easy way to do this?
fancy's user avatar
  • 50.6k
526 votes
16 answers
1.0m views

How to clean node_modules folder of packages that are not in package.json?

Assume I install project packages with npm install that looks into package.json for modules to be installed. After a while I see that I don't need some specific module and remove its dependency from ...
Sergei Basharov's user avatar
389 votes
16 answers
275k views

How to install a private NPM module without my own registry?

I've taken some shared code and put it in an NPM module, one I don't want to upload to the central registry. The question is, how do I install it from other projects? The obvious way is probably to ...
futlib's user avatar
  • 8,368
233 votes
10 answers
123k views

NodeJS require a global module/package

I'm trying to install globally and then use forever and forever-monitor like this: npm install -g forever forever-monitor I see the usual output and also the operations that copy the files to the ...
alexandernst's user avatar
  • 14.8k
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
190 votes
14 answers
147k views

Node package ( Grunt ) installed but not available

I'm trying to build a github jquery-ui library using grunt, but after running npm install I still can't run the command according to the readme file. It just gives No command 'grunt' found: james@...
AJP's user avatar
  • 27.8k
163 votes
9 answers
122k views

Download source from npm without installing it

How can I download the source code of a package from npm without actually installing it (i.e. without using npm install thepackage)?
AURIGADL's user avatar
  • 1,942
153 votes
8 answers
208k views

Print a list of all installed node.js modules

In a node.js script that I'm working on, I want to print all node.js modules (installed using npm) to the command line. How can I do this? console.log(__filename); //now I want to print all ...
Anderson Green's user avatar
138 votes
5 answers
184k views

How to install a node.js module without using npm?

There are quite a few modules which are listed on node's github page but are not published with the npm-registry. These modules can't be installed using npm. What is the correct way to install these ...
vivekian2's user avatar
  • 3,904
111 votes
3 answers
21k views

What are `rc` files in nodejs?

I have some questions regarding various rc files in a typical node application, like .npmrc, .babelrc etc. What is an rc file, I know its a runtime-config for the module, but anything else? Does the ...
Gopikrishna S's user avatar
90 votes
3 answers
90k views

Installing "global" npm dependencies via package.json [duplicate]

I have a few "global" dependencies (jshint, csslint, buster, etc..) that I'd like to have automatically installed and executable via the command line when my package is installed via npm install. Is ...
gxc's user avatar
  • 5,098
83 votes
8 answers
30k views

Difference between a module and a package in Node.js?

I am new to Node.js. What is the difference between a "package" and a "module" in Node.js?
Breako Breako's user avatar
66 votes
3 answers
38k views

Install a locally developed npm package globally

I'm developing a node package that needs to be run from shell. I know I have to install the package globally, but running $> npm install -g ./my_module Does not give me the desired result, that ...
Kuba Orlik's user avatar
  • 3,460
64 votes
2 answers
32k views

what does grunt "test command" do on npm init

I'm trying to learn grunt. When I run npm init, I get a prompt in the process of creating a package.json file that asks for "test command" - I'm not sure how to utilize this, or what it's expecting. ...
mheavers's user avatar
  • 30k
63 votes
8 answers
67k views

Global NPM package installed but command not found

I have globally installed two npm packages "download" and "enigmavirtualbox" via command line: npm install -g download and npm install -g engimavirtualbox I'm trying to use them in a batch file to ...
bendulum's user avatar
  • 1,837
51 votes
3 answers
23k views

Is Lerna needed anymore with NPM workspaces?

Is Lerna needed anymore with NPM 7.0.0 workspaces? I don't really have experience with this new npm feature. npm/RFCs writes: First and foremost there’s the alternative of leaving the problem set for ...
Markus Guder's user avatar
48 votes
3 answers
38k views

NPM package 'bin' script for Windows

Cucumber.js is supplying a command-line "binary" which is a simple .js file containing a shebang instruction: #!/usr/bin/env node var Cucumber = require('../lib/cucumber'); // ... The binary is ...
jbpros's user avatar
  • 1,647
43 votes
10 answers
113k views

Package is not publishing to npm (not in the npm registry)

I would like to publish my git repository to npm so I can use it in other projects. But when I run the npm publish command I get the following error: npm ERR! code E404 npm ERR! 404 Not Found - PUT ...
Niels Bosman's user avatar
35 votes
7 answers
20k views

Can I run a private npm repository without replicating the public repository?

I'm writing a number of pieces of code (for internal use) using node.js and want to store the modules (packaged up for npm) in a package repository for each distribution to the various machines they ...
Quentin's user avatar
  • 935k
31 votes
4 answers
23k views

How to automatically copy files from package to local directory via postinstall npm script?

I want to automatically copy certain files from an npm package to user's local directory after running npm install my-package I can get them installed by declaring "files" inside package.json. The ...
Dmitri Zaitsev's user avatar
25 votes
1 answer
7k views

How do I see the release notes for an npm package before I upgrade?

Does the npm registry expose release notes in a standardized way? I've seen release notes in: The README.md On GitHub as a tagged release with no description On GitHub as a tagged release with a ...
Weston's user avatar
  • 1,952
23 votes
5 answers
45k views

Using npm how can I download a package as a zip with all of its dependencies included in the package

What I'm trying to do is download packages with all their dependencies, in order to transfer them to another computer that does not have an internet connection and install it there. So the scenario ...
l__flex__l's user avatar
  • 1,428
22 votes
3 answers
26k views

Use npm package on client side

is there a way I can use an npm package on the client side? For example, I want to use the dateformat(https://www.npmjs.com/package/dateformat) package in my client side javascript file
Trung Tran's user avatar
  • 13.6k
18 votes
1 answer
10k views

Create npm package using webpack

I'm creating an npm package and using webpack for loader like babel, eslint etc.. However I'm under assumption that final compiled version of the package should only contain that one module, without ...
Martin Tale's user avatar
15 votes
4 answers
52k views

The engine "node" is incompatible with this module. Expected version "12.x". Got "14.8.0"

I try to do a yarn add, but I have this error: The engine "node" is incompatible with this module. Expected version "12.x". Got "14.8.0"
Anroche's user avatar
  • 749
15 votes
3 answers
49k views

How to run start scripts from package.json?

I've two scripts in package.json "start:dev": "nodemon ./src/index.js", "start": "npm run build && node ./build/index.js", npm start works well. I need to run "start:dev": "nodemon ./src/...
Hashir Hussain's user avatar
15 votes
3 answers
23k views

Where does node.js put its files?

I have recently started playing with node.js, but I got lost in a big mess of different versions of node, npm, nvm and other packages. I don't know what is installed globally and what is installed ...
mik01aj's user avatar
  • 12.2k
14 votes
7 answers
13k views

How can I update all npm packages/modules at once?

I'm struggling to find a way to update all npm packages in one go, some articles suggest that package.json file should be edited where all version numbers need to be changed to * therefore forcing ...
Ilja's user avatar
  • 45.7k
14 votes
6 answers
15k views

Error publishing a new version of a package in npm

I'm trying to republish a package using npm. I did update the package version in package.json, yet I get the following error: npm ERR! publish Failed PUT 404 npm ERR! Windows_NT 6.3.9600 npm ERR! ...
Michał Szydłowski's user avatar
14 votes
4 answers
8k views

How to write Git hash to (node's) package.json?

is there a way to automatically update version number of a package.json (https://npmjs.org/doc/json.html) with the HEAD hash of git? I would like to have something like version: 1.0.0+...
Sebastian Sebald's user avatar
14 votes
2 answers
14k views

What's an npm command to install devDependencies globally?

I'd prefer to type a short command, like npm install -g, to setup a project's global dependencies, such as node-sass and jshint, than manually typing out npm install -g every single package. Is there ...
apennebaker's user avatar
13 votes
2 answers
7k views

Change root directory on npm publish

Is it possible to change the root directory of my Node.js npm package when I do a publish? What I have is following: ├── lib ├── package.json ├── .npmignore ├── src │   ├── index.js │   └── sub │   ...
LongFlick's user avatar
  • 1,137
12 votes
2 answers
7k views

Node.js: Get (absolute) root path of installed npm package

Task I'm looking for an universal way to get the (absolute) root path of an installed npm package in Node.js. Problem I know about require.resolve, but that will give me the entry point (path to ...
x-ray's user avatar
  • 3,319
12 votes
0 answers
662 views

Should polyfills be a dependency or a devDependency?

As explained by this SO post, polyfills should be in the dependency folder. However, the Array.find() polyfill has the following installation instructions. npm install --save-dev jspolyfill-array....
ptk's user avatar
  • 7,403
11 votes
2 answers
11k views

Module vs. Dependency vs. Library vs. Package vs. Component

I understand that packages hold several modules, but I'm starting to get confused as to if packages and modules are dependencies. Also, libraries to me maybe seem like packages you install via NPM, ...
Jake_West's user avatar
  • 131
11 votes
1 answer
4k views

Webpack - No Output File, No Errors Reported

I am learning Webpack and going through it again and again. In the latest build, there is something very strange going on. CLI reports everything is well & the output file dress_aphrodite.js is ...
Kayote's user avatar
  • 15.3k
10 votes
1 answer
14k views

Use auth token to query a private NPM registry for a given package version, but without filesystem access?

The purpose of this effort is to be able to test whether a package version exists in a private registry, without having to touch the filesystem / config files. For packages in public registries this ...
Ian's user avatar
  • 11.6k
10 votes
4 answers
10k views

Check package version at runtime in nodejs?

I have some of my entries in package.json defined as "*" "dependencies": { "express": "4.*", "passport": "*", "body-parser": "*", "express-error-handler": "*" }, I wan't to freeze ...
nacho4d's user avatar
  • 44.7k
10 votes
2 answers
14k views

Where to put frontend javascript configuration variables

I have a Javascript frontend that does Ajax calls to my backend. To do that, it needs a "backend_URL" that I hard-coded in the Ajax get() call, say "http://myservice/backend". Now if I want to ...
JulienD's user avatar
  • 7,213
10 votes
6 answers
4k views

npm installs many dependencies

I bought an HTML template recently, which contains many plugins placed inside a bower_components directory and a package.js file inside. I wanted to install another package I liked, but decided to use ...
RA.'s user avatar
  • 1,009
9 votes
6 answers
27k views

What needs to change in this package.json file to work with npm 0.3.0?

Trying to use a lib but getting this error... npm ERR! JSON.parse Failed to parse package.json data. npm ERR! JSON.parse Note that package.json must be actual JSON, not npm ERR! JSON.parse just a ...
fancy's user avatar
  • 50.6k
9 votes
2 answers
9k views

I published one package on npm, but it's not showing in the search list when i am going to search

I published one package as a public & i am trying to search it on npm (https://www.npmjs.com/), but there is no package available with that name on npm. Tried with: npm install package-name ->...
Krishna Ghatul's user avatar
9 votes
5 answers
42k views

How to install nodejs and npm on windows using command lines

I am creating a package installer which has nodejs, redis, and socket.io as prerequisites. The problem is that I don't want the developers to install the prerequisites own their own. I figured out a ...
Kamga Simo Junior's user avatar
9 votes
1 answer
2k views

Node: check latest version of package programmatically

I'd like my node package (published on npm) to alert the user when a new version is available. How can i check programmatically for the latest version of a published package and compare it to the ...
pistacchio's user avatar
  • 58.3k
9 votes
2 answers
3k views

Creating NPM packages, how to document them?

I'm in the process of creating a few NPM packages and I'd like to know what are the best practices to write the user documentation for them (as there's very little information, and searching for ...
fortran's user avatar
  • 75.4k
9 votes
4 answers
31k views

Cannot Install NPM Package - Code 128 An unknown git error occurred

I'm trying to install the package @truffle/hdwallet-provider . As written in the doc, I'm running: npm i @truffle/hdwallet-provider Here is the error message I'm getting: npm ERR! code 128 npm ERR! ...
Henri's user avatar
  • 1,711

1
2 3 4 5
9