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,317
questions
299
votes
13
answers
360k
views
npm install private github repositories by dependency in package.json
I'm trying to install github private repository by npm that includes other private github repositories as dependency.
Have tried a lot of ways and posts but none is working. Here is what i'm doing :
...
296
votes
17
answers
128k
views
On npm install: Unhandled rejection Error: EACCES: permission denied
I have managed to corrupt my npm install, and whenever I try to install packages using npm install, I receive error messages along these lines:
Unhandled rejection Error: EACCES: permission denied, ...
296
votes
34
answers
511k
views
ERROR in Cannot find module 'node-sass'
Config: macOS High Sierra, version 10.13.2, node:v8.1.2 npm:5.0.3
When I run npm start in my angularjs project I get this error:
ERROR in Cannot find module 'node-sass'
After this I run:
npm i node-...
296
votes
8
answers
201k
views
How to use private Github repo as npm dependency
How do I list a private Github repo as a "dependency" in package.json? I tried npm's Github URLs syntaxes like ryanve/example, but doing npm install in the package folder gives "could not install" ...
294
votes
9
answers
428k
views
Is there any way to fix package-lock.json lockfileVersion so npm uses a specific format?
If two different developers are using different versions of node (12/15) & npm (6/7) in a project that was originally created using a package-lock.json "lockfileVersion": 1, when the ...
291
votes
30
answers
517k
views
'tsc command not found' in compiling typescript
I want to install typescript, so I used the following command:
npm install -g typescript
and test tsc --version, but it just show 'tsc command not found'. I have tried many ways as suggested in ...
291
votes
3
answers
123k
views
Why use peer dependencies in npm for plugins?
Why does, for example, a Grunt plugin define its dependency on grunt as "peer dependencies"?
Why can't the plugin just have Grunt as its own dependency in grunt-plug/node_modules?
Peer dependencies ...
290
votes
11
answers
483k
views
How to update TypeScript to latest version with npm?
Currently I have TypeScript 1.0.3.0 version installed on my machine.
I want to update it to latest one i.e. 2.0.
How to do this with npm?
289
votes
10
answers
609k
views
"npm config set registry https://registry.npmjs.org/" is not working in windows bat file
I create a.bat on windows 7, the content of a.bat is:
@echo off
npm config set registry https://registry.npmjs.org/
and then run a.bat, but not working, I find the word "set" is special keyword for ...
288
votes
11
answers
550k
views
How do I do a clean install (delete node_modules and install) with npm?
Is there a way to get npm to unbuild all the modules under node_modules? Something like npm rebuild that removes all build artifacts but doesn't rebuild them?
287
votes
4
answers
173k
views
Do I need both package-lock.json and package.json?
After updating my NPM to the latest version (from 3.X to 5.2.0) and running npm install on an existing project, I get an auto-created package-lock.json file.
I can tell package-lock.json gives me an ...
283
votes
5
answers
116k
views
What is the bower (and npm) version syntax?
Bower enables me to specify version requirements for packages using the following syntax:
"dependencies": {
"<name>": "<version>",
},
But I have not been able to find what is the ...
281
votes
2
answers
107k
views
What does npm -D flag mean?
I am about to install this npm package and it says npm install -D load-grunt-config. What does the -D flag do?
277
votes
9
answers
317k
views
After installation of Gulp: “no command 'gulp' found”
After installing gulp.js via npm, I receive a no command 'gulp' found error when running the gulp command from the same directory it was installed into.
When looking under the node_modules/.bin/ ...
276
votes
18
answers
329k
views
How to Set port in next.js
One application is running on port 3000 and I want to run another application on a different port from the default port, which is 3000. How do I change this in React Next.js? My package.json currently ...
276
votes
6
answers
254k
views
How to use a different version of python during NPM install?
I have terminal access to a VPS running centos 5.9 and default python 2.4.3 installed. I also installed python 2.7.3 via these commands: (I used make altinstall instead of make install)
wget http://...
275
votes
19
answers
414k
views
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
I am trying all possible ways to create a React application. I have tried Maven, and now I am trying create-react-app from Facebook Incubators.
When I tried to run the command create-react-app my-app ...
274
votes
14
answers
266k
views
npm install -g less does not work: EACCES: permission denied
I'm trying to set up less on phpstorm so I can compile .less files to .css on save. I have installed node.js and the next step (according to this https://www.jetbrains.com/webstorm/help/transpiling-...
270
votes
50
answers
596k
views
npm ERR! Error: EPERM: operation not permitted, rename
When I execute npm install I get this error
npm ERR! Error: EPERM: operation not permitted, rename C:\projects******\node_modules\react-async-script' -> 'C:\projects*******\node_modules.react-...
269
votes
4
answers
272k
views
DeprecationWarning: Buffer() is deprecated due to security and usability issues when I move my script to another server
Getting error when script move to other server.
(node:15707) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer....
268
votes
26
answers
518k
views
Running Python on Windows for Node.js dependencies
I am getting into a Node.js codebase which requires that I download a few dependencies via NPM, namely jQuery.
In attempting to run npm install jquery, I keep getting this error:
Your environment ...
268
votes
27
answers
501k
views
Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`
Recently, when I compile my scss files I get an error. The error message says:
Browserslist: caniuse-lite is outdated. Please run next command npm update caniuse-lite browserslist
First, as the ...
266
votes
21
answers
370k
views
Nodejs cannot find installed module on Windows
I am learning nodejs at the moment on Windows. Several modules are installed globally with npm.cmd, and nodejs failed to find the installed modules. Take jade for example,
npm install jade -g
Jade ...
263
votes
4
answers
171k
views
Is there a difference between `npm start` and `npm run start`?
I am able to run both the npm start and npm run start commands. I used create-react-app to create my application. To make configuration changes in the CSS module, I want to run npm eject but it throws ...
261
votes
46
answers
491k
views
NPM stuck giving the same error EISDIR: Illegal operation on a directory, read at error (native)
I am stuck with this error no matter what directory I am in, and what I type after "npm" in cmd.exe. Here is the npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\...
261
votes
10
answers
188k
views
How do I uninstall a package installed using npm link?
When installing a node package using sudo npm link in the package's directory, how can I uninstall the package once I'm done with development?
npm link installs the package as a symbolic link in the ...
259
votes
36
answers
534k
views
npm not working - "read ECONNRESET"
I'm having a problem with npm, I cant install anything. Here is the error messages:
C:\Windows\system32>npm install -g yo
npm http GET https://registry.npmjs.org/yo
npm http GET https://registry....
259
votes
17
answers
496k
views
Fix the upstream dependency conflict installing NPM packages
I am trying to npm install vue-mapbox mapbox-gl, and I'm getting a dependency tree error.
I'm running Nuxt.js SSR with Vuetify and haven't installed anything related to Mapbox prior to running this ...
257
votes
15
answers
213k
views
can you host a private repository for your organization to use with npm?
Npm sounds like a great platform to use within an organization, curious if a private repo is possible, like with Nexus/Maven. Nothing comes up on Google :(
256
votes
34
answers
357k
views
When I run `npm install`, it returns with `ERR! code EINTEGRITY` (npm 5.3.0)
I am getting this error while running sudo npm install. On my server, npm was installed earlier. I've tried to delete the package-lock.json file, and ran npm cache clean --force, but it didn't work.
...
254
votes
10
answers
251k
views
How to load npm modules in AWS Lambda?
I've created several Lambda functions using the web based editor. So far so good. I'd now like to start extending those with modules (such as Q for promises). I can't figure out how to get the modules ...
247
votes
10
answers
210k
views
Running NPM scripts sequentially
Let's say I have
"scripts": {
"pre-build": "echo \"Welcome\" && exit 1",
"build_logic": "start cmd.exe @cmd /k \"yo esri-appbuilder-js:widget && exit 1\"",
"post_build": ...
245
votes
19
answers
371k
views
NPM global install "cannot find module"
I wrote a module which I published to npm a moment ago (https://npmjs.org/package/wisp)
So it installs fine from the command line:
$ npm i -g wisp
However, when I run it from the command line, I ...
245
votes
4
answers
189k
views
How can I publish an npm package with distribution files?
I would like to publish a npm package that contains my source as well as distribution files. My GitHub repository contains src folder which contains JavaScript source files. The build process ...
245
votes
4
answers
143k
views
Purpose of installing Twitter Bootstrap through npm?
Question 1:
What exactly is the purpose of installing Twitter Bootstrap through npm? I thought npm was meant for server side modules. Is it faster to serve the bootstrap files yourself than using a ...
243
votes
4
answers
626k
views
What is the difference between npm install and npm run build?
What is the difference between npm install and npm run build?
I have noticed in my project that sometimes npm starts failing when npm install is performed, but, upon running npm run build, it works ...
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 ...
240
votes
14
answers
387k
views
How to make the webpack dev server run on port 80 and on 0.0.0.0 to make it publicly accessible?
I am new to the whole nodejs/reactjs world so apologies if my question sounds silly. I am currently playing around with reactabular.js.
Whenever I do a npm start it always runs on localhost:8080.
How ...
237
votes
15
answers
210k
views
The best way to run npm install for nested folders?
What is the most correct way to install npm packages in nested sub folders?
my-app
/my-sub-module
package.json
package.json
What is the best way to have packages in /my-sub-module be installed ...
237
votes
8
answers
238k
views
npm install from Git in a specific version
Assumed that I have written a module for Node.js which I would like to keep private. I know that I can (should) add the line:
"private": "true"
to the package.json file, and I also know that I can ...
237
votes
16
answers
650k
views
Checking version of angular-cli that's installed?
Is there a way to check the specific version of angular-cli that's installed globally on my machine? I'm in a Windows environment.
*npm -v* and *node -v* only gives me the version of npm and node ...
237
votes
10
answers
155k
views
What is the recommended way to install Node.js, nvm and npm on MacOS X?
I am trying to use Homebrew as much as possible. What's the recommended way to install Node.js, nvm and npm on MacOS X?
234
votes
7
answers
128k
views
npm: disable postinstall script for package
Is it any npm option exist to disable postinstall script while installing package? Or for rewriting any field from package.json?
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 ...
232
votes
7
answers
312k
views
Deleting `package-lock.json` to Resolve Conflicts quickly
In a team set up, usually, I have faced merge conflicts in package-lock.json and my quick fix has always been to delete the file and regenerate it with npm install. I have not seriously thought about ...
231
votes
9
answers
317k
views
How do I install a module globally using npm?
I recently installed Node.js and npm module on OSX and have a problem with the settings I think:
npm install [MODULE] is not installing the node.js module to the default path
which is /usr/local/lib/...
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/...
228
votes
6
answers
160k
views
How to tell if an npm package was installed globally or locally
I am installing Grunt, Node.js, npm, Bower, and grunt-cli on Windows 7.
The instructions say I should run the install commands with the -g flag for global.
How can I check if I used the -g flag when I ...
225
votes
47
answers
760k
views
npm - EPERM: operation not permitted on Windows
I ran
npm config set prefix /usr/local
After running that command,
When trying to run any npm commands on Windows OS I keep getting the below.
Error: EPERM: operation not permitted, mkdir 'C:\...
224
votes
4
answers
203k
views
How to edit a node module installed via npm?
I'm using the node_swiz module, which in turn uses the validator module.
I want to make changes to the validator module, but I used npm install to install the modules/dependencies.
Can I just make ...