Questions tagged [npm]
npm is the package manager shipped with Node.js. It can be used to install and publish CommonJS and ECMAScript modules, jQuery plugins, reusable JavaScript code (libraries), JavaScript-based CLI programs, and more.
50,290
questions
224
votes
4
answers
113k
views
"All Rights Reserved" license in package.json
I have a small node.js project that is company-internal and will not be released publicly or shared with third parties. It certainly will not be contributed to any public package repositories.
But ...
224
votes
6
answers
265k
views
How to set custom location for local installation of npm package?
Is it possible to specify a custom package destination for npm install, either through a command flag or environment variable?
By default, npm local installs end up in node_modules within the current ...
221
votes
15
answers
142k
views
How do I view the size of npm packages?
When I search for packages on NPM, I would like to see package sizes (in KB or MB, etc). NPM doesn’t seem to show this information.
How can I determine how much bloat an NPM package will add to my ...
220
votes
46
answers
728k
views
Message "the term 'ng' is not recognized as the name of a cmdlet"
Today, while working through some basic AngularJS introduction, I ran into a problem.
I opened PowerShell to get going on the project. NPM worked.
I was able to install Angular using:
npm install -g @...
219
votes
10
answers
123k
views
How to list all the Node.js modules I have linked with npm
I am looking for a command that will list the names of global modules that I have npm link'd to local copies, also listing the local path.
In fact, a list of all globally installed modules would be ...
218
votes
9
answers
96k
views
Should "node_modules" folder be included in the git repository
I'm wondering if we should be tracking node_modules in our repo or doing an npm install when checking out the code?
216
votes
15
answers
336k
views
NodeJS - Error installing with NPM
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Windows\system32>npm install caress-server
npm http GET https://registry.npmjs.org/caress-server
npm ...
216
votes
11
answers
148k
views
How do I update devDependencies in NPM?
npm update seems to just update the packages in dependencies, but what about devDependencies.
Right now you can install devDependencies by running npm install ., but this doesn't work for npm update ....
214
votes
7
answers
63k
views
When to use Yarn over NPM? What are the differences?
What are the differences between Yarn and NPM?
At the time of writing this question I can only find some articles on the Internet showing what's the Yarn equivalent of an NPM command.
Do they have the ...
213
votes
14
answers
467k
views
"A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received", What does that mean?
I'm working on a React application and I use some npm modules, one of which I had to build myself. (my NPM package:
https://www.npmjs.com/package/modale-react-rm).
It is a simple modal that opens and ...
212
votes
23
answers
237k
views
Install Node.js on Ubuntu
I'm trying install Node.js on Ubuntu 12.10 (Quantal Quetzal), but the terminal shows me an error about lost packages. I tried with this:
sudo apt-get install python-software-properties
sudo add-apt-...
211
votes
2
answers
125k
views
What is the "module" package.json field for?
I've seen some npm packages (vue for example) have a module field in their package.json.
But module is not included in the package.json documentation - is this a convention of some kind? Is there ...
211
votes
7
answers
146k
views
Install dependencies globally and locally using package.json
Using npm we can install the modules globally using -g option. How can we do this in the package.json file?
Suppose, these are my dependencies in package.json file
"dependencies": {
"mongoose": "...
210
votes
29
answers
767k
views
npm can't find package.json
I'm trying to install the dependencies of some example: npm's express 2.5.8 that I've downloaded, but all of the apps throw the same error:
c:\node\stylus>npm install -d
npm info it worked if it ...
210
votes
15
answers
297k
views
Yarn global command not working
I'm working with Yarn v0.16.1. If I understand correctly (according to the documentation), yarn global add <package> should be the equivalent of npm install -g <package>. However, when I ...
209
votes
42
answers
446k
views
ng: command not found while creating new project using angular-cli
Installed angular-cli globally using (npm install -g angular-cli) but when I'm trying to create project using ng new my-project it is throwing error:
ng: command not found
208
votes
7
answers
543k
views
How to run eslint --fix from npm script
I am trying to add lint-fix in my package.json.
My basic lint is "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
I did try "lint-fix": "eslint --fix --ext .js,.vue src test/unit/...
208
votes
8
answers
185k
views
Installing Bower on Ubuntu
I'm trying to install Bower on XUbuntu 13.10, following the instructions on the Bower home page, after doing sudo apt-get install npm and sudo npm install -g bower I get the following after issuing ...
208
votes
4
answers
83k
views
What is the difference between npm-shrinkwrap.json and package-lock.json?
With the release of npm@5, it will now write a package-lock.json unless a npm-shrinkwrap.json already exists.
I installed npm@5 globally via:
npm install npm@5 -g
And now, if a npm-shrinkwrap.json ...
207
votes
3
answers
79k
views
What do the --save flags do with npm install
I see instructions to install a package with either
npm install <package_name>
or
npm install <package_name> --save
or
npm install <package_name> --save-dev
What is the ...
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 ...
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 ...
204
votes
12
answers
256k
views
Yarn - How do I update each dependency in package.json to the latest version?
I have a react app with deprecated dependencies. To make it work, I have to update the dependencies to their newer (but stable) versions.
As per this stakoverflow thread, to update dependencies in ...
201
votes
34
answers
372k
views
ExpressJS - throw er Unhandled error event
I created expressjs application using the following commands:
express -e folderName
npm install ejs --save
npm install
When I run the application with: node app.js, I have the following errors:
...
201
votes
4
answers
213k
views
How to install package with local path by Yarn? It couldn't find package
In my package.json I'm pointing local package my-custom-i18n by its relative path:
package.json
"dependencies": {
"core-js": "^2.4.1",
"my-custom-i18n": "...
201
votes
12
answers
132k
views
how to install multiple versions of package using npm
Due to https://github.com/npm/npm/issues/2943, npm will never support the ability to alias packages and install multiple versions of the same package.
The workarounds posted on the github issue might ...
199
votes
1
answer
205k
views
Should the package-lock.json file be added to .gitignore? [duplicate]
To lock the versions of dependencies that are installed over a project, the command npm install creates a file called package-lock.json. This was made since Node.js v8.0.0 and npm v5.0.0, as several ...
195
votes
4
answers
91k
views
How to find reverse dependencies on npm package?
I'd like to find out which packages depend on express among the installed sails/kraken/loopback/hapi/koa etc. Are there npm sub-commands or other ways to locally list all reverse dependencies on one ...
195
votes
2
answers
130k
views
Difference between `npm start` & `node app.js`, when starting app?
I have installed an application using the command express new 'filename'. I have just learned that you can start an application using:
npm start
Thus far I have used:
node app.js
to start my ...
194
votes
10
answers
73k
views
NPM cannot install dependencies - Attempt to unlock something which hasn't been locked
I've been trying to run an npm install on my package.json file, but I'm having a lot of trouble. It keeps saying "Error: Attempt to unlock XXX, which hasn't been locked" on all my dependences. Here'...
194
votes
22
answers
342k
views
NPM doesn't install module dependencies
This is my package.json for the module that I'm including in the parent project:
{
"version": "0.0.1",
"name": "module-name",
"dependencies": {
"express": "3.3.4",
"grunt": "0.4.1",
...
194
votes
6
answers
68k
views
NPM - How to fix "No readme data"
I have a simple package.json:
{
"name": "camapaign",
"version": "0.0.1",
"scripts": {
"start": "node app.js"
},
"engines": {
"node": "0.10.15",
"npm": "1.3.5"
},
"repository"...
194
votes
16
answers
321k
views
Jest gives `Cannot find module` when importing components with absolute paths
Receiving the following error when running Jest
Cannot find module 'src/views/app' from 'index.jsx'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:179:17)
at Object.<...
192
votes
5
answers
88k
views
Use of @ symbol in Node module names [duplicate]
I'm looking at some code from a coworker wrote and she's using the @ symbol in require statements. This is the first line of one of these files:
var restServer = require('@company/config')
When I ...
191
votes
22
answers
224k
views
Error: The 'brew link' step did not complete successfully
I'm trying to install node.js via Homebrew. Unfortunately, I get this error:
➜ ~ brew install node
==> Downloading http://nodejs.org/dist/v0.8.10/node-v0.8.10.tar.gz
#############################...
191
votes
12
answers
109k
views
Why did package-lock.json change the integrity hash from sha1 to sha512?
I just generated a new npm lockfile, package-lock.json, as part of my typical workflow. But I noticed that this time all of the integrity hashes have been changed from sha1 to sha512. What is ...
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@...
190
votes
13
answers
333k
views
How can I run a command with administrator rights with Visual Studio code terminal?
The new version 1.2.0 includes a terminal, but when I try to install any pack with Node.js, I get the "npm ERR! code EPERM" that I usually solve by right-clicking and running it as ...
190
votes
6
answers
97k
views
npm install and build of forked github repo
I'm using a module for my angular app called angular-translate. However, I've had to make a few small modifications to the source code to get everything working the way I'd like, and now I want to ...
189
votes
5
answers
104k
views
npm - install dependencies for a package in a different folder?
I have the following directory structure:
/some_project
source.js
package.json
I would like to install the dependencies for some_project.
I know I could cd into some_project and then run ...
189
votes
10
answers
149k
views
How do I import global modules in Node? I get "Error: Cannot find module <module>"?
I am trying to setup Node on Mac OSX Lion. It all seems to work ok, but I can't seem to import anything modules from my global modules folder. I get the error,
Error: Cannot find module <module>...
188
votes
15
answers
224k
views
Module not found: Error: Can't resolve 'core-js/es6'
I've got a problem with my build process in relation to my React app.
I always get the following error:
Module not found: Error: Can't resolve 'core-js/es6'
if I use this in a polyfill.js:
import '...
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 ...
186
votes
49
answers
671k
views
npm install errors with Error: ENOENT, chmod
I am trying to globally install an npm module I just published. Every time I try to install, either from npm or the folder, I get this error.
npm ERR! Error: ENOENT, chmod '/usr/local/lib/...
185
votes
26
answers
334k
views
webpack is not recognized as a internal or external command,operable program or batch file
I am Learning React.js and i am using windows 8 OS.i have navigate to my root folder
1.Created the package.json file by npm init
2. install webpack by npm install -S webpack.now webpack has been ...
184
votes
16
answers
134k
views
unable to resolve dependency tree error for creating new angular project
so today I wanted to create a new Angular project using the command ng new <projectname> and I got this error:
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While ...
183
votes
24
answers
873k
views
Fixing npm path in Windows 8 and 10
Have done a lot of googling, tried reinstalling node.js using the official installer, but my npm pathing still doesn't work.
This doesn't work
npm install foo
I get an error message saying missing ...
183
votes
28
answers
407k
views
Using npm behind corporate proxy .pac
I need to download several packages through npm but our corporate proxy configuration is a .pac file (i'm on windows)
I have already tried
npm config set proxy http://mydomain\username:[email protected]....
179
votes
9
answers
169k
views
ERROR in The Angular Compiler requires TypeScript >=3.1.1 and <3.2.0 but 3.2.1 was found instead
I am getting this error
ERROR in The Angular Compiler requires TypeScript >=3.1.1 and <3.2.0 but 3.2.1 was found instead.
Seems like Typescript updated but the Angular Compiler doesn't like ...
179
votes
22
answers
478k
views
npm install error - unable to get local issuer certificate
I am getting an unable to get local issuer certificate error when performing an npm install:
typings ERR! message Unable to read typings for "es6-shim". You should check the
entry paths in "es6-shim....