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.

npm is the package manager shipped with .

npm can be used to install and publish and ECMAScript modules as well as JavaScript-based CLI programs. See the npm homepage for more information.

npm has the ability to install packages to a local directory or globally with the -g flag. Global packages are generally CLI programs.

npm packages manage dependencies and pass information to npm through the file. It contains entries for package name, version, git, dependencies, and other information. The official documentation can be found here.

npm uses the system. This system promote three version stages as well as suffixes. For example, v1.2.3-alpha. npm supports modifiers such as asterisks and greater/less than signs when specifying dependencies. More information can be found here and here.

As of April 14, 2015 npm also supports private modules that can be defined and used only by users who you specify. More about private modules here.

npm comes bundled with the installation of NodeJS, so there is no need for a separate install.

To search for modules:

Documentation Links:

Useful links:

49337 questions
22
votes
5 answers

Shared component library best practices

I am creating a shareable React component library. The library contains many components but the end user may only need to use a few of them. When you bundle code with Webpack (or Parcel or Rollup) it creates one single file with all the code. For…
Ollie Williams
  • 1,996
  • 3
  • 25
  • 41
22
votes
1 answer

Docker and npm - gyp ERR! not ok

Everything was working with my client until I tried to solve some Network disconnected issue by upgrading react-scripts in my docker client service from 3.0.1 to 3.3.0, using npm install --save and building it again. But then it started…
8-Bit Borges
  • 9,643
  • 29
  • 101
  • 198
22
votes
3 answers

Use Verbose when building with Webpack and NPM

I have the following package.json file and I am building using webpack: { "name": "web", "private": true, "scripts": { "build": "webpack --config webpack.config.js --mode development" }, "devDependencies": { "webpack": "4.21.0", …
Miguel Moura
  • 36,732
  • 85
  • 259
  • 481
22
votes
2 answers

Unsupported engine node / NPM only when building in Docker

I have a dependency in my package.json which itself has the following dependency: "node-rdkafka": "^2.5.0", Using nvm on my local machine and setting my node version to 8.9.1, and my npm version is 5.5.1, I can successfully run npm install…
Greg Peckory
  • 7,700
  • 21
  • 67
  • 114
22
votes
2 answers

npm install shows error with git not found

I have recently added some dependencies to the package JSON and tried installing npm, but it shows errors related to git not found: npm ERR! path git npm ERR! code ENOENT npm ERR! errno ENOENT npm ERR! syscall spawn git npm ERR! enoent Error while…
Harikrishnan C U
  • 239
  • 1
  • 2
  • 5
22
votes
2 answers

error C2039: 'IsNearDeath': is not a member of 'Nan::Persistent>

I recently upgraded my nodejs to v12.3.1, and now when I try to run npm install in my project repository, I am getting the preceding errors. error C2059: syntax error: ')' (compiling source file ..\src\custo m_importer_bridge.cpp) error C2660:…
Sibeesh Venu
  • 18,755
  • 12
  • 103
  • 140
22
votes
4 answers

How to use npm packages inside dart code?

I have a flutter application running on the Dart programming language. I have published an npm package that I want to use in my flutter application. Is there any way I can use the existing npm package in dart or somehow automatically convert npm…
Waqar Ul Khaf
  • 569
  • 1
  • 3
  • 15
22
votes
8 answers

Docker: npm not found

I have the following Dockerfile: FROM ubuntu USER root RUN apt-get update && apt-get install curl -y RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - RUN apt-get update && apt-get upgrade -y && apt-get install nodejs -y RUN mkdir…
Sohrab
  • 1,348
  • 4
  • 13
  • 33
22
votes
2 answers

Locking NPM version?

I am using .nvmrc file to lock in my Node version for my project. Is there a way to lock in my NPM version as well? I want to make sure that anyone that runs my project is on the same setup.
jjoan
  • 383
  • 1
  • 3
  • 17
22
votes
2 answers

what do lines starting with double-slash '//' mean in a .npmrc?

I'd naively assumed that .npmrc lines with double slash ('//') indicate a comment, but that's clearly not the case, because when I delete them, I'm unable to publish to my local…
Jolly Roger
  • 3,913
  • 4
  • 24
  • 23
22
votes
4 answers

gatsby --version > -bash: gatsby: command not found

I use mac and I installed gatsby-cli by: npm install --global gatsby-cli and 'npm root -g' command prints: /usr/local/lib/node_modules/npm/lib/node_modules npm successfully installed gatsby but, I cannot run gatsby command (gatsby --version,…
leonkong
  • 459
  • 3
  • 5
  • 15
22
votes
7 answers

'webpack-dev-server' is not recognized as an internal or external command,

I cloned this Webpack Starter package through github using gitbash following a tutorial on pluralsight. I am trying to access webpack through Visual Studio Code's integrated terminal but i get the following error. I am new to this so kindly help me…
Raza Zaidi
  • 520
  • 1
  • 3
  • 17
22
votes
1 answer

What is the correct way to import and use d3 and its submodules in ES6?

I'm trying to use a number of d3 packages in a Vue.js project with NPM for package management. I was trying to make a fiddle of a problem I'm having but am unable to replicate the issue there - the code works exactly as it should do. I'm trying to…
Mourndark
  • 2,526
  • 5
  • 28
  • 52
22
votes
2 answers

Is it possible to ignore the dependency hash validation of just one module (or registry)?

The yarn.lock file saves all the dependencies versions and the hashes of the modules. I know that I can globally disable this hash checking with the option --skip-integrity-check. We have an internal module that is continually developed. The…
neves
  • 33,186
  • 27
  • 159
  • 192
22
votes
2 answers

Yarn installing multiple versions of the same package

I have angular in my dependencies at 1.5.11: { "dependencies": { "angular": "1.5.11", "angular-foundation": "0.7.0" } } angular-foundation happens to depend on angular@>=1.3.0. Why does Yarn install angular@1.6.9 as a nested…
marekpw
  • 662
  • 2
  • 5
  • 19