How to fix npm ERR! code EPROTO npm ERR! errno EPROTO npm ERR! request failed: protocol error in npm
The npm EPROTO protocol error occurs when npm cannot establish a secure connection to the registry due to SSL/TLS issues, proxy misconfiguration, or symlink problems. It typically indicates network connectivity issues.
Quick fix
Fixes npm ERR! code EPROTO npm ERR! errno EPROTO npm ERR! request failed: protocol error
npm cache clean --force- Clear npm cache and verify connectivity
- Update Node.js and npm to the latest versions
- Configure npm proxy settings (if behind corporate proxy)
- Switch to HTTP registry or disable strict SSL temporarily
npm cache clean --forcenpm ERR! code EPROTOnpm ERR! errno EPROTOnpm ERR! request failed: protocol error
What this error means
EPROTO stands for 'protocol error' and occurs when there's a mismatch or failure in the network protocol communication between npm and the registry server. This error most commonly happens when npm attempts to download packages over HTTPS and encounters SSL/TLS protocol negotiation failures. The error can manifest in three ways: SSL handshake failures (when the client and server cannot agree on encryption parameters), proxy-related protocol mismatches (common in corporate environments), or symlink creation failures on virtualized systems like Vagrant. The underlying issue is that npm cannot successfully communicate with registry.npmjs.org or your configured npm registry.
Typical symptoms
- npm install or npm update fails with 'request to https://registry.npmjs.org/[package] failed, reason: write EPROTO' error
- SSL routines errors appear in the output, such as 'SSL23_GET_SERVER_HELLO:unknown protocol'
- Error mentions 'protocol error, symlink' when attempting to create symbolic links in node_modules
- npm install works on some machines but fails on others, especially in corporate or virtualized environments
- The error persists even after clearing npm cache or retrying the installation
Common causes
- SSL/TLS protocol mismatch between npm client and registry server, often due to outdated Node.js or npm versions
- Proxy server misconfiguration in corporate networks where http and https proxies use different ports
- Incompatible elliptic curves for encryption negotiation between client and server during the SSL handshake
- Symlink creation restrictions in virtual machines (Vagrant, VirtualBox) or shared folders with improper permissions
- Network connectivity issues or firewall/SSL inspection intercepting HTTPS connections to the registry
How to fix "npm ERR! code EPROTO npm ERR! errno EPROTO npm ERR! request failed: protocol error"
Start by clearing the npm cache, which may contain corrupted data from failed downloads:
npm cache clean --forceThen verify you can reach the npm registry:
curl https://registry.npmjs.org/npmIf curl fails, the issue is network-related and may require proxy configuration or firewall adjustments.
Outdated versions often have SSL/TLS compatibility issues. Update to the latest stable versions:
npm install -g npm@latest
node --version
npm --versionFor Node.js, download the latest LTS version from https://nodejs.org/ and reinstall. This resolves many SSL/TLS negotiation problems.
If you're behind a corporate proxy, configure npm with your proxy details:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8181
npm config listReplace proxy.company.com with your actual proxy server and the ports with your actual ports. After configuration, retry: npm install
If proxy configuration doesn't work, try switching the npm registry to HTTP:
npm config set registry http://registry.npmjs.org/Alternatively, disable strict SSL verification (use with caution, only as temporary troubleshooting):
npm config set strict-ssl falseAfter trying npm install, re-enable strict SSL for security:
npm config set strict-ssl trueIf the error specifically mentions 'symlink' (common on Vagrant/Windows), use the --no-bin-links flag:
npm install --no-bin-linksFor Vagrant users, enable symlinks in VirtualBox by adding this to your Vagrantfile:
config.vm.provider "virtualbox" do |v|
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
endAdvanced notes
If you're dealing with legacy TLS versions or corporate SSL inspection, you may need to configure the Node.js/OpenSSL environment. Some corporate proxies intercept HTTPS traffic and re-encrypt it with their own certificates, causing SSL handshake failures. Contact your network team to obtain the corporate CA certificate and configure Node.js to trust it. For Vagrant environments, consider running npm install on the host machine to avoid symlink and protocol issues.
Frequently asked questions
- What does "npm ERR! code EPROTO npm ERR! errno EPROTO npm ERR! request failed: pr" mean?
- EPROTO stands for 'protocol error' and occurs when there's a mismatch or failure in the network protocol communication between npm and the registry server. This error most commonly happens when npm attempts to download packages over HTTPS and encounters SSL/TLS protocol negotiation failures. The error can manifest in three ways: SSL handshake failures (when the client and server cannot agree on encryption parameters), proxy-related protocol mismatches (common in corporate environments), or symlink creation failures on virtualized systems like Vagrant.
- How do I fix "npm ERR! code EPROTO npm ERR! errno EPROTO npm ERR! request failed: pr"?
- The npm EPROTO protocol error occurs when npm cannot establish a secure connection to the registry due to SSL/TLS issues, proxy misconfiguration, or symlink problems. It typically indicates network connectivity issues.
- What causes "npm ERR! code EPROTO npm ERR! errno EPROTO npm ERR! request failed: pr"?
- SSL/TLS protocol mismatch between npm client and registry server, often due to outdated Node.js or npm versions Proxy server misconfiguration in corporate networks where http and https proxies use different ports Incompatible elliptic curves for encryption negotiation between client and server during the SSL handshake
- Is the "npm ERR! code EPROTO npm ERR! errno EPROTO npm ERR! request failed: pr" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐npm Official Documentation
- ๐Node.js Issue: EPROTO error(GitHub)
- ๐ฌSO: EPROTO error with HTTPS(Stack Overflow)
- ๐