Can't install express because npm install express error

16,951

Solution 1

I also had a problem like that... and looking around for various solutions on the internet I tried a few of these:

  • Try npm install to another repository
  • Try install another version of node.js
  • npm set registry http://registry.npmjs.org/

If the above method still fails. You can try these:

  1. Uninstall nodejs from Programs & Features with the uninstaller.
  2. Delete these files:
    • C:\Program Files (x86)\Nodejs
    • C:\Program Files\Nodejs
    • C:\Users\{User}\AppData\Roaming\npm
    • C:\Users\{User}\AppData\Roaming\npm-cache
    • C:\Users\{User}\.npmrc (and possibly check for that without the . prefix too)
  3. Reboot, for good measure
  4. Try too install node.js again
  5. Try too nmp install to destination repository

Good luck... with what I mentioned above, I was able to solve the problem with my setup.

Solution 2

I experienced this issue and based on the error message, I noticed the certificate (.crt) and the private key (.pem) files I have in the ssl folder needed to have this lines before the start and at the end of the key contents:

-----BEGIN RSA PRIVATE KEY-----

Your key contents go here for .pem file

-----END RSA PRIVATE KEY-----

The same is required for the certificate file and missing either generates the same error:

-----BEGIN CERTIFICATE-----

Your certificate contents go here for .crt file

-----END CERTIFICATE-----

Solution 3

Do the following :

Delete the following mention

  • npm cache clean -f
  • C:\User\user\appdata\roaming\npm-cache
  • C:\User\user\appdata\roaming\npm
  • C:\User\user\appdata\Local\Temp
  • C:\programefile\nodejs
  • delete node version manager (nvm) is their
  • type where node on cmd if it shows node js path means node js is properly not uninstalled
  • delete node js and npm path from environment variable
  • go to this much address C:\User\user them right click on empty space and go to property and tick on hidden in order to get .npmrc file and delete all reated to it
  • delete other version of node js if installed

after doing this much restart your pc and then install new latest recommended version of node js. After installed the node js run node -v to check version you installed and npm -v for npm version

Share:
16,951

Related videos on Youtube

crow
Author by

crow

Updated on June 04, 2022

Comments

  • crow
    crow almost 2 years

    I'm receiving the following errors when trying to install express:

    1. npm ERR! code ERR_OSSL_PEM_NO_START_LINE
    2. npm ERR! errno ERR_OSSL_PEM_NO_START_LINE
    3. npm ERR! request to https://registry.npmjs.org/express failed, reason: error:0909006C:PEM routines:get_name:no start line
    • Moti Korets
      Moti Korets over 4 years
      What its the command you run? Which version of npm you have? Is it only happens for express or other packages?
    • crow
      crow over 4 years
      yes,i run on command npm version 6.10.0
  • crow
    crow over 4 years
    it be inefficient
  • Philippe Fanaro
    Philippe Fanaro almost 4 years
    It's good to know that uninstalling works, but it is usually a better solution to fix the specific problem, both for the user and the team who owns the software.
  • Philippe Fanaro
    Philippe Fanaro almost 4 years
    What does "inefficient" mean in this context?