The npm installation process gets stuck

Here is the content of my package.json:

{
"name": "my-example-app",
"version": "0.1.0",
"dependencies": {

  "request": "*",
  "nano": "3.3.x",
  "async": "~0.2"
  }
}

After trying to run npm install in the command prompt, I am experiencing a hang during the installation process. Can anyone help me figure out what might be causing this issue?

Answer №1

Encountered a similar issue where npm was unable to download packages due to incorrect proxy settings.

To troubleshoot, it is recommended to run:

$ npm install --verbose

This will help identify any underlying issues. If you have not configured a proxy before, potential causes could include:

  • Outdated npm version.
  • Internet connection problems.
  • Inadequate permissions for npm to make file modifications.

Answer №2

If you're experiencing issues, consider removing the package-lock.json file and then executing npm install. I found success with this method.

Answer №3

Dealing with a similar issue, I attempted the following steps:

npm config set registry http://registry.npmjs.org/

This was an effort to disable https. Additionally, I experimented with

npm set progress=false 

To eliminate the progress bar as it was believed to be causing slower downloads.

Ultimately, the root of the problem lay in my network driver. After restarting my system, the lag disappeared completely.

Answer №4

To fix this issue on my MacOS system, I used the following command:

networksetup -setv6off Wi-Fi

If you want to go back to the default settings, simply run:

networksetup -setv6automatic Wi-Fi

Answer №5

Encountering a similar problem on my macOS, I spent some time wrestling with it until I stumbled upon this helpful solution:

npm config rm proxy
npm config rm https-proxy
npm config set registry http://registry.npmjs.org/

Answer №6

Executing the command npm cache clear --force
has successfully resolved a similar problem for me before.

Additionally, during the execution of npm install on a network without internet access (I have shared my experience using Verdaccio), I encountered an issue where the installation process would get stuck at the final stage. Disabling auditing (by running npm set audit false) on the offline machine solved this specific issue.

Answer №7

Mac OS was giving me trouble until I updated npm. Simply run the following command:

sudo npm install -g npm@latest

Answer №8

Due to the restrictions of my corporate proxy, I often rely on an additional intermediary proxy to allow NTLM authentication.

While attempting npm install through CNTLM proxy resulted in frequent hangs, switching to NTLM-APS (a comparable proxy) resolved the issue.

Answer №9

Although results may differ, executing npm cache verify resolved the problem on my end.

Answer №10

It felt odd at first, but I realize now that my impatience was getting the best of me. I decided to run -> npm install --verbose and noticed some progress, although it was moving very slowly!!! Ultimately, all it took was a little patience :D

Answer №11

Get rid of node_modules and package-lock.json from previous npm installation, then reinstall

rm -rf node_modules package-lock.json
npm install

or

If the npm install process gets stuck and displays...

npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY

npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY

npm ERR! request to https://registry.npmjs.org/jest failed, reason: unable to get local issuer certificate"

then,

npm config set strict-ssl false
npm install

or

Follow these steps to properly uninstall Node.js and reinstall it

https://www.geeksforgeeks.org/how-to-completely-remove-node-js-from-windows/

I personally faced this issue and resolved it by executing npm config set strict-ssl false

Answer №12

It was quite unexpected, but simply restarting my computer and rerunning the npm install command solved the issue.

Answer №13

If your SSH key is protected with a password, remember to run the command ssh-add. This will prevent npm from getting stuck while prompting for your password.

Answer №14

For those who may find it helpful, I wanted to share what solved my issue:

Even though my npm proxy settings were correct on my computer, when running npm install, it would get stuck indefinitely at the sill extract stage. Re-attempting npm install just resulted in the same package being stuck repeatedly.

After waiting for a considerable amount of time, an error message finally appeared during npm install, suggesting that git was encountering issues fetching something.

The problem was resolved after setting up the git proxy using this command:

git config --global http.proxy https://proxy-server:port

It's important to note the use of https in the value of http.proxy, as without it, the configuration did not work properly. Each user may have different proxy server settings (http / https / port), so it's worth investing some time into experimenting with both npm and git proxy configurations.

Answer №15

Our firewall originally blocked access to the registry for Cordova (https://registry.npmjs.org/cordova), causing an issue. Once unblocked, the problem was resolved.

Answer №16

After trying various suggestions, I decided to switch to a new network and surprisingly, it resolved my issue.

Answer №17

When I encountered a similar issue on my Windows computer, I attempted various solutions without success. Ultimately, the resolution that worked for me was disabling the ransomware protection feature that I had previously enabled. It seems that this feature was causing conflicts with npm.

Answer №18

This issue has come up for me multiple times.

  1. On one occasion, I was on a VPN when I accidentally pressed Ctrl-C and disconnected from the VPN. Surprisingly, running npm install worked flawlessly after that.
  2. In another instance, I was not connected to a VPN when I mistakenly hit Ctrl-C and then connected to the VPN. To my surprise, npm install started working again.

Answer №19

This solution has proven effective for me when facing npm installation blocks with packages for IONIC, ReactNative, and other npm packages.

To implement a temporary fix, follow these steps:

npm config set prefix C:\Users\[username]\AppData\Roaming\npm\node_modules2

  • Adjust the path in environment variables to:

    C:\Users[username]\AppData\Roaming\npm\node_modules2

  • Proceed with the package installation command.

  • In File Explorer, copy the following link:

    C:\Users[username]\AppData\Roaming\npm\node_modules

    A new folder named "node_modules2" will be created within node_modules, containing your package folder.

  • Copy the CMD file of your package to the parent folder "npm".

  • Move your package folder to the parent folder "node_modules".

  • Now execute the following command:

    npm config set prefix C:\Users\[username]\AppData\Roaming\npm

  • Adjust the path in environment variables to:

    C:\Users[username]\AppData\Roaming\npm

Your package should now function correctly through the command line interface.

Answer №20

It's possible that the issue you're facing is similar to one I encountered recently. I also ran into a problem with a stalled "npm install," but fortunately, I was able to resolve it.

In my situation, I needed to add typescript as a local dependency in my project:

npm i typescript --save-dev

It turned out that this local installation was conflicting with a globally installed version of typescript, causing the shell to hang indefinitely without completing or throwing an error...

To remedy this, I removed the global typescript installation using the -g flag:

npm uninstall typescript -g

Once I did this, the initial command executed successfully! 👍

Answer №21

When I was trying to run `npm install`, the process seemed stuck, and it turned out that it was because it was waiting for me to enter a password for my SSH key during cloning from a Git repository. There was no prompt for the password, and I realized this when I typed random characters and saw no response. To resolve the issue, I checked the dependencies listed in the `package.json` file and cloned those repositories locally. Then, I updated the `package.json` file by adjusting the paths of these Git repositories to point to their local locations. After making these changes, the installation proceeded without any further issues.

Answer №22

While trying to install electronjs on Windows 10, I encountered a persistent hanging issue with npm. Even after reinstallation, the problem persisted. Surprisingly, I discovered that electronjs had successfully installed on another desktop within the same network. After some investigation, I identified Bitdefender free edition as the culprit behind the installation hang-up. Strangely, the antivirus did not provide any warning but silently blocked the installation process. The console also remained open indefinitely during installation, further complicating the issue. To troubleshoot similar problems, consider disabling your antivirus/firewall on Windows and ensure that your network settings are not blocking npm's communication capabilities. Unfortunately, npm lacks a straightforward way of notifying users about network blocks, causing installations to stall without clear feedback.

Answer №23

For those using MacOS (specifically Mojave 10.14), the following solution was very helpful to me: https://github.com/reactioncommerce/reaction/issues/1938#issuecomment-284207213

Execute the following commands:

echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
sudo sysctl -w kern.maxfiles=65536
sudo sysctl -w kern.maxfilesperproc=65536
ulimit -n 65536

After that, attempt npm install once again.

Answer №24

Make sure to review your environment variables for both http and https settings.

If there are any problematic entries, consider removing them to resolve potential issues.

Re-run the "npm install" command for a fresh start.

Answer №25

Turning off my windows firewall solved the issue for me. Experimenting with different npm versions might also help.

Answer №26

Make sure to review your .npmrc configuration file for the presence of a registry entry (which designates a server serving as a package cache.)

In my case, I encountered issues where the npm install command would halt midway due to an outdated or unresponsive server specified in my .npmrc file. To resolve this, either delete the line or comment it out:

>cat ~/.npmrc
#registry=http://oldserver:4873

(Additionally, consult with your IT department or project leader to investigate why the operation is not functioning properly ;)

Answer №27

Resolved the problem by installing nvm (Node Version Manager) and rolling back the node version from 14 to 12 in my situation

Answer №28

My issue was resolved by removing and reinstalling node and npm. I am running Ubuntu 20.04.1 LTS.

Answer №29

My experience with encountering an error was due to running npm within a Docker container on WSL2, where the configuration of nameservers by docker in WSL2 was incorrect, resulting in the inability of the container to resolve hosts.

To test if your container (or even your host) can resolve hosts, you can attempt running: curl https://github.com. In my situation, I encountered

curl: (6) Could not resolve host: github.com
.

The issue with the docker container is avoided when I switch from using the default bridge to a custom bridge and associate the container with it. As a result, the resolv.conf file contains the appropriate nameserver details:

$ cat /etc/resolv.conf 
nameserver 127.0.0.11
options ndots:0

The IP address 127.0.0.11 corresponds to the docker DNS server, resolving the problem in my case.

If you are not utilizing npm within a container, your problem might still be linked to a misconfigured resolv.conf file (especially if you are operating on a Linux machine or on Windows with WSL/WSL2).

Answer №30

If you come across this issue, let the npm installation run for an extended period of time. Eventually, the Jest extension (v4.2.1) crashed and the npm installation was able to finish successfully.

Upon examining the Jest configuration, it appears that a test auto-watch feature was activated. I did not make any adjustments to the Jest settings myself, so this feature must be included by default.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Standardizing URLs with ExpressJS router

Seeking normalized/canonical URLs for a single page application running on an ExpressJS server. While the SPA is supported by a server-side router, templates can vary slightly for different app URLs. One particular difference is the presence of the <li ...

Share a Node.js Express.js npm package for universal access within the project

Here is my current folder structure. /app.js /src /routes /controllers Within the routes folder, there are multiple javascript files that all require the passport.js package like so: const passport = require('passport'); Is it possible to c ...

What is the process of mocking an Express JWT unless function?

I am currently utilizing Express along with Express-JWT for my project. Within an Express() instance, I have the following code: const api = express() api.use(jwt({ // my options })) For testing purposes, I have created a file named mocks\express- ...

Encountering issues when trying to install Gulp using nvm

This particular issue has really got me scratching my head. I faced the same problem when attempting to install -g. The package.json file is completely empty, leaving me unsure of what steps to take next. {21:32}~/dev/repo/fo-website ➭ npm install gul ...

Node application encountering error callback invocation post request

I am currently working on a node application that functions as a web server. It receives a POST request containing a filename, file path, and the content of the file. The application then creates the file and sends back a response with a 201 message. Belo ...

Creating a document in Mongodb using Mongoose and NodeJS seems like a daunting task

I'm facing an issue with Mangoose and NodeJS. Allow me to explain: I have a MongoDB called "babyfootdb" and the connection with Mongoose is functioning properly. Within the database, there's a collection named players. I simply wish to add ...

The best practices for handling assets (css) in MEAN.js and Node.js

MEAN.js utilizes configuration files for managing CSS files, as well as automatically loading all CSS files for each module. Query #1: What is the method to exclude specific files from the list? Query #2: How can a particular CSS file be included only on ...

Is there a way to update the version of an npm package in Azure DevOps without causing a new pipeline to be

Our Current Project Automation Utilizing Azure Pipelines (azure-pipelines.yml) for ci/cd automation, we have a configuration segment dedicated to finalizing the project versioning process before publishing to Azure Artifacts. Our goal is to seamlessly upd ...

In a perplexing twist, requests made to the Express app arrive with empty bodies despite data being sent, but this anomaly occurs

Welcome to the community of inquisitive individuals on Stack! I'm facing an interesting challenge while developing an Express app. Despite everything running smoothly with two routes, I've hit a roadblock with one route that seems to have empty i ...

I am experiencing issues with my Discord bot not registering or responding to any

Having trouble with my Discord Bot - it powers up but doesn't respond to commands. Here's the code snippet: const Discord = require("discord.js"); const client = new Discord.Client( {intents: 32767}, ); { partials: ['MESSAGE&a ...

Issue: Error code 0308010C encountered in the digital envelope routines, indicating unsupport for the command npm run storybook

Whenever I attempt to run npm run storybook An error pops up in the terminal: Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19) at Object.createHash (node:crypto:133:10) Operating System - ...

Nuxt.js pages are displaying a 404 error, indicating that the content cannot

I've developed a nodejs project using adonuxt and have SSL enabled on my website. The issue I'm facing is related to using nginx as a reverse proxy to handle requests to localhost:port on my server. There are two main problems that I'm enc ...

Packaging npm modules involves including files from the root folder of a package within a monorepo

In my monorepo setup, I have a mix of private and public packages. There are some common files in the root folder that I want to include when I run npm pack. I tried creating symlinks and specifying '../../file' in the files attribute of the pack ...

Adding npm packages to your Vue.js application

My Vue app is structured like this (auto created by vue init webpack myProject): index.html components/ -main.js -App.vue I am trying to include npm packages, such as https://github.com/ACollectionOfAtoms/atomic-bohr-model. Following the instructions, I ...

Encountered a problem during the installation of Ionic on Ubuntu 18.04

Looking for guidance on the installation process of Ionic 4 on Ubuntu 18.04. Can anyone advise on the compatible versions of npm, Node.js, Cordova, and Android SDK required for a successful installation? I attempted the installation myself but encountere ...

What steps should I take to resolve the 'invalid mime type' issue while transmitting an image as a binary string to Stability AI via Express?

Currently, I am facing an issue while attempting to utilize the image-to-image API provided by stabilityAI. The task at hand involves sending an image as a binary string through my express server to the stability AI API. However, when I make the POST reque ...

Instruct npm to search for the package.json within a designated directory

Imagine having a folder structure that looks like this: root |-build |-package.json |-src |-foo |-foo.csproj |-foo.cs |-bar.cs |-bin |-... |-foo.sln Now, if you change the current directory to root\src\foo\bin a ...

When new <p>text</p> is added, MaterialUI Textfields shift away from the center

In my Sign In page, I have Textfields for users to enter their username and password. If the user enters incorrect data, an error message is shown indicating that the username or password is invalid. Interestingly, when this error message appears, the Text ...

There was a dependency issue that caused the task ':react-native-camera:compileDebugJavaWithJavac' to fail

I'm encountering difficulties while trying to run an older project. I will update it once I am able to successfully open it. Whenever I use ./gradlew build, I receive this message: https://i.stack.imgur.com/tYinI.png This is the content of my build ...

Is it necessary to include "import { createServer } from 'http';" in order to utilize the websockets/ws library with Express in Node.js?

After encountering an issue with my working express server, I attempted to add websockets functionality using the following code: import express from "express"; import { WebSocketServer } from 'ws'; const app = express(); const port = 8 ...