Certificate error encountered while using create-react-app at the office

I’m facing a challenge when trying to start a new React app with the create-react-app command. It runs smoothly on my personal laptop, but at work, it keeps throwing an error.

The command I’m running is:

npx create-react-app my-app

And here’s the error message I receive:

npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY

npm ERR! unable to get local issuer certificate

I suspect it has something to do with the network restrictions at my workplace. Has anyone else experienced this issue? What solutions do you recommend to overcome this certificate problem?

i had the same issue too. our office network blocked some certs. try this: run npm config set registry http://registry.npmjs.org/ to switch to http. it helped me. just make sure to let IT know so they don’t freak out lol.

Corporate networks often have custom certificate authorities that intercept SSL connections for security monitoring. I encountered this exact error at my previous job and found that adding my company’s root certificate to npm’s certificate store resolved it permanently. You can ask your IT team for the corporate root certificate file and then configure npm to use it with npm config set cafile /path/to/certificate.pem. This is more secure than disabling SSL entirely. Alternatively, your IT department might have a documented process for developers - they usually do since this affects most development tools, not just npm. Worth noting that your Node version is quite outdated which might contribute to certificate validation issues with newer registry endpoints.

This certificate issue is pretty common in corporate environments with strict firewall policies. The workaround that worked for me was setting npm to ignore SSL errors temporarily by running npm config set strict-ssl false. However, be cautious with this approach as it reduces security. Another option is to configure npm to use your company’s proxy settings if they have one - you can get the proxy details from your IT department and set them using npm config set proxy and npm config set https-proxy commands. Also worth checking if your Node.js version is compatible since you’re running a fairly old version. Sometimes updating Node and npm resolves certificate chain issues.

The “Unable to Get Local Issuer Certificate” error stems from a misconfigured SSL certificate on your local machine. The error is often linked to self-signed or corporate certificates, particularly with Git. This is a common issue that developers often encounter while using Git Bash, a Windows command-line tool to push, pull, or clone a Git repository. Some ways to fix the error are as follows:-

  • Alter the php.ini File
  • Add SSL Certificate to Trusted Certificate Store
  • Reinstall Git & Select SSL Transport Backend Option
  • Grant Repository Access to SSL Certificates or Reassign Path in VS Code
  • Disable SSL certificate

Hope it helps!