angularssl-certificatepem

How do i solve error:0480006C:PEM routines::no start line?


Everytime i use ng serve or npm start i get this error out of nowhere, everyting was working perfect but after i restarted VS code i can't run my project idk why!! An unhandled exception occurred: error:0480006C:PEM routines::no start line
See "C:\WINDOWS\TEMP\ng-ewpjdi\angular-errors.log" for further details.


Here is angular-errors.log :

[error] Error: error:0480006C:PEM routines::no start line at node:internal/tls/secure-context:69:13 at Array.forEach () at setCerts (node:internal/tls/secure-context:67:3) at configSecureContext (node:internal/tls/secure-context:156:5) at Object.createSecureContext (node:_tls_common:117:3) at Server.setSecureContext (node:_tls_wrap:1352:27) at Server (node:_tls_wrap:1211:8) at new Server (node:https:74:3) at Object.createServer (node:https:112:10) at Server.createServer (E:\project\node_modules\webpack-dev-server\lib\Server.js:2528:57)

I tried to replace that file with an old version of it but still the same problem


Solution

  • I just had the same issue when attempting to use a self-signed SSL certificate for a localhost webserver.

    The problem happened because I tried using a Certificate Request file cert-request.csr.

    A trustworthy signed certificate is signed by a Certificate Authority. So cert-request.csr fails to work in the application because is not a valid certificate.

    To finish the SSL setup, you must sign the certificate yourself, or have it signed by a trusted Certificate Authority.

    To sign it yourself, you can use a command like this:

    openssl x509 -req -signkey private.key -in csr.csr -out certificate.crt
    

    Then update your server to use the new certificate.crt file instead of the .csr file.