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
179
votes
12
answers
329k
views
Can't get Gulp to run: cannot find module 'gulp-util'
On Windows 7, I've installed gulp as explained here: http://markgoodyear.com/2014/01/getting-started-with-gulp/:
npm install gulp -g
In my app folder: npm install gulp --save-dev
I create a gulpfile....
179
votes
7
answers
121k
views
Should I commit yarn.lock and package-lock.json files?
We're using yarn for all our deterministic pkg installations but don't prevent the user from using npm - I'm guessing having both these files will cause issues however. Should one be added to your ....
179
votes
3
answers
107k
views
What is "entry point" in npm init
I have an empty new project, when i run npm init i got a list of questions to answer, for example:
name: (karma)
version: (1.0.0)
description:my project description
entry point: (index.js)
I am ...
178
votes
7
answers
201k
views
How to install only "devDependencies" using npm
I am trying to install ONLY the "devDependencies" listed in my package.json file. But none of the following commands work as I expect. All of the following commands install the production dependencies ...
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 [...
178
votes
3
answers
61k
views
How do I find all installed packages that depend on a given package in NPM?
I have a npm package that i want to update. I can update my package.json, but I don't want to break something. Is there a way to list all of the installed packages that depend on it?
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 ...
177
votes
5
answers
177k
views
npm equivalent of yarn resolutions?
Is there an npm equivalent of the yarn resolutions functionality? There is no mention of it in the npm package.json docs.
For example, I want to install [email protected] and one of its dependencies (@lerna/...
177
votes
10
answers
121k
views
How do I fix a vulnerable npm package in my package-lock.json that isn't listed in the package.json?
GitHub is telling me that a dependency in my package-lock.json file is vulnerable and outdated. The problem is that if I do npm install or npm update, neither of them update the dependency in the ...
175
votes
13
answers
640k
views
npm not working after clearing cache
Before clearing cache
npm cache clear
npm is working fine. After clearing cache, it is not working.
The error log below suggest problem with internet connectivity but internet connection is just ...
175
votes
22
answers
312k
views
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (88)
I have tried to install gulp-sass latest version with npm i gulp-sass --save-dev in the begining I got a lot of errors but later solved them. But whenever I try to run gulp I got this error:
Error: ...
174
votes
33
answers
512k
views
Command not found after npm install in zsh
I'm having some problems installing vows via npm in zsh. Here's what I get. I tried installing it with and without the -g option. Do you have any idea what's wrong here?
[❤ ~/Desktop/sauce-node-demo:...
173
votes
14
answers
52k
views
Jest SecurityError: localStorage is not available for opaque origins
When I want to run my project with the command npm run test, I get the error below. What is causing this?
FAIL
● Test suite failed to run
SecurityError: localStorage is not available for opaque ...
171
votes
25
answers
342k
views
VSC PowerShell. After npm updating packages .ps1 cannot be loaded because running scripts is disabled on this system
I design websites in VSC and PowerShell is my default terminal.
After updating and deploying a website to firebase earlier, I was prompted to update firebase tools - which I did using npm. ...
171
votes
15
answers
443k
views
Node.js Error: Cannot find module express
I wrote my first node.js app, but it can't find express library:
C:\ChatServer\Server>node server.js
module.js:340
throw err;
^
Error: Cannot find module 'express'
at Function....
169
votes
22
answers
341k
views
nodemon not working: -bash: nodemon: command not found
I'm on a Mac running El Capitan. I have node v5.6.0 and npm v3.6.0.
When I try to run nodemon, I get:
-bash: nodemon: command not found
I thought this may mean that I didn't have nodemon installed,...
169
votes
7
answers
146k
views
Get version number from package.json in React Redux (create-react-app)
OP EDIT: If anyone else comes across this: the app was created using create-react-app, which limits importing to within the src folder. However if you upgrade react-scripts to v1.0.11 it does let you ...
169
votes
37
answers
382k
views
npm install hangs
This is my package.json:
{
"name": "my-example-app",
"version": "0.1.0",
"dependencies": {
"request": "*",
"nano": "3.3.x",
"async": "~0.2"
}
}
Now, when I open the cmd and run npm install, ...
169
votes
6
answers
181k
views
How can I change the cache path for npm (or completely disable the cache) on Windows?
I've installed Node.js on my Windows 7 x64 development machine, the manual way:
mkdir C:\Devel\nodejs
cd C:\Devel\nodejs
set NODE_PATH=%CD%
setx /M PATH "%PATH%;%NODE_PATH%"
setx /M NODE_PATH "%...
169
votes
11
answers
47k
views
How to publish a module written in ES6 to NPM?
I was about to publish a module to NPM, when I thought about rewriting it in ES6, to both future-proof it, and learn ES6. I've used Babel to transpile to ES5, and run tests. But I'm not sure how to ...
168
votes
46
answers
427k
views
NPM: npm-cli.js not found when running npm
Usually I can install a library using npm but today when installing yeoman I encountered this errors. Please help to figure out what's root cause.
D:\Works\phonegap\ionic\todo>npm install -g yo
...
168
votes
5
answers
175k
views
bower command not found
I tried to install twitter bower on my Mac, and I used
npm install bower -g
Then I tried bower --help, and the output was bower command not found. Why is that?
168
votes
2
answers
86k
views
What is deduped in npm packages list?
I am running command as npm list and I get below mentioned list as my dependencies and I want to know what is the meaning of deduped. Please let me know the meaning of this.
167
votes
12
answers
281k
views
npm global path prefix
I am being more cautious than usual because I have been confused by the behavior of npm in the past.
I am on a Mac and have installed node.js through brew install node.
Now that I want to run ...
167
votes
14
answers
407k
views
Change default global installation directory for node.js modules in Windows?
In my windows installation PATH includes C:\Program Files\nodejs, where executable node.exe is. I'm able to launch node from the shell, as well as npm. I'd like new executables to be installed in C:\...
166
votes
11
answers
55k
views
Is there a way to alphabetize package.json without installing a package?
I've been working on lots of old npm packages that have their dependencies all out of order. They're shrinkwrapped packages, so updating dependencies is a bit of work (testing and verifying that the ...
166
votes
6
answers
141k
views
How to suppress output when running npm scripts
I have decided to experiment with npm scripts as a build tool and so far I like it. One issue I'd like to solve is when running a script to run jshint when something doesn't pass linting I get a ton ...
166
votes
15
answers
420k
views
npx command not found
I am working with webpack and I need to execute ./node_modules/webpack/bin/webpack.js using npx. npx webpack would run the webpack binary (./node_modules/webpack/bin/webpack), but each time I execute ...
165
votes
28
answers
951k
views
How to resolve Node.js: "Error: ENOENT: no such file or directory"
I have a Node.js web application currently running on a server successfully. Now I'm trying to set up a local copy on my development server.
I currently have Node.js, NPM and MongoDB Installed just ...
164
votes
22
answers
357k
views
How to update npm
I'm trying to install mean.io boilerplate. It fails when running sudo npm install -g meanio@latest. Prior to failing it notes that it 'wants' npm version 1.4.x, whereas I have 1.2.18 installed. So I ...
164
votes
5
answers
51k
views
JavaScript dependency management: npm vs. bower vs. volo [closed]
How do you compare npm, bower and volo?
All three can be used to install JavaScript dependencies for a UI project.
I understand npm is more node specific.
So, when to use what?
npm still stands ...
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)?
163
votes
3
answers
127k
views
What is the equivalent of "npm install <package_name> --save" in Yarn?
I am using Yarn to install the dependencies of my project. What is the equivalent of "npm install <package_name> --save " in Yarn to update the entry in my package.json file? I can use ...
163
votes
6
answers
143k
views
`npm build` doesn't run the script named "build" in package.json
For a new module I'm trying to use npm build without gulp / Grunt / other specialised build tools.
"scripts": {
"build": "node build.js"
},
My build.js is simply
console.log('Hello')
However, ...
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/...
161
votes
4
answers
74k
views
How do you resolve Git conflicts in yarn.lock
When multiple Git branches modify the dependencies in a project that uses Yarn, it is likely to introduce a conflict in the yarn.lock file. It is not a good idea to delete and regenerate the yarn.lock ...
161
votes
6
answers
144k
views
Determine command line working directory when running node bin script
I am creating a node command line interface. It is installed globally and uses a bin file to execute.
I plan to have a command window open at the root directory of the files I am working on and then ...
159
votes
10
answers
157k
views
How to use npm with ASP.NET Core
I'm using npm to manage the jQuery, Bootstrap, Font Awesome and similar client libraries I need for my ASP.NET Core application.
The approach that worked for me started by adding a package.json file ...
158
votes
11
answers
145k
views
Install npm module from gitlab private repository
We are using GitLab for our private project. There are some forked libraries from github, that we want to install as npm module. Installing that module directly from npm is ok and for example this:
...
157
votes
47
answers
761k
views
"internal/modules/cjs/loader.js:582 throw err"
I'm getting the following error in the console:
Error : Cannot find module.
Here is the full error. What should I do?
internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module ...
157
votes
26
answers
334k
views
How can I solve error "gypgyp ERR!ERR! find VSfind VS msvs_version not set from command line or npm config"?
I want to install Adonis Admin. When I run npm install I get:
> [email protected] install C:\laragon\www\adonis-admin\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp ...
157
votes
5
answers
175k
views
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents
I'm trying to run this project.
After updating minimatch version to 3.10.9, I'm getting the following error:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\webpack\...
156
votes
7
answers
194k
views
How to reset the npm registry in global npm config
Is there any way to change or reset the global npm registry.
Appreciate your assistance.
155
votes
20
answers
485k
views
Npm Error - No matching version found for
i clone a project with git, the project was create with ionic 2 but when i execute the command for re-create the node_modules folder i get this error.
npm install
npm WARN deprecated [email protected]....
154
votes
7
answers
120k
views
How to set shell for npm run-scripts in Windows
I'm running npm on Windows and would like to use & style parallel operations in run-scripts
but running in parallel in cmd is kind of messy
in my package.json file I'd like to write-
scripts: { ...
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 ...
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/@...
153
votes
7
answers
288k
views
Global npm install location on windows?
I'm not 100% sure, but I believe I installed node v5 from the windows installer on both my home and office PCs.
On my home PC global installs happen under %APPDATA%:
(dev) go|c:\srv> which lessc
...
152
votes
12
answers
82k
views
Job name "..getProjectMetadata" does not exist
I updated my angular to v9 and when I try to go back in v8, I receive this error.
I have already tried the following:
uninstall -global angular/cli
uninstall angular/cli
go back to my last package....
152
votes
19
answers
208k
views
npm ERR! Refusing to delete / code EEXIST
I'm just running a simple npm install and i get this error.
npm ERR! path /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/@angular/cli/node_modules/webpack/node_modules/yargs/...