Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install openssl failed on windows 10

I am running the following command in Node.js command window in Win10. It failed. anyone has ideas how to fix it? I am running Node.js v7.3.0

C:\Users\haozhang>npm install openssl
C:\Users\haozhang
`-- [email protected]
  +-- [email protected]
  `-- [email protected]
    +-- [email protected]
    | `-- [email protected]
    `-- [email protected]

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\haozhang\package.json'
npm WARN haozhang No description
npm WARN haozhang No repository field.
npm WARN haozhang No README data
npm WARN haozhang No license field.

C:\Users\haozhang>openssl
'openssl' is not recognized as an internal or external command,
operable program or batch file.
like image 877
Kenneth Avatar asked Mar 21 '17 05:03

Kenneth


People also ask

Why is my npm install failing?

This cause of this error is that one of the dependencies you define in your package. json file fails to be installed properly on your computer. This means that npm fails to install the node-sass module that's added as a dependency to the n-app project.


2 Answers

As mentionned by Royi Mindel the npm openssl package is just a wrapper around the openssl binaries and not the actual openssl. You need to install openssl on your Windows 10 machine as follows:

  1. Download the binaries from https://code.google.com/archive/p/openssl-for-windows/downloads
  2. Extract to C:\OpenSSL-Win32\ (or whatever name you want to give it).
  3. Add the system environment variable OPENSSL_CONF with value c:\OpenSSL-Win32\openssl.cnf (points to the config file where you extrated the binaries)
  4. Add C:\OpenSSL-Win32\bin to your Path environment variable
  5. Open a cmd or PowerShell and type openssl version. It should work and you should see the version installed

Info taken from: https://www.tbs-certificates.co.uk/FAQ/en/openssl-windows.html

like image 187
Chris Aelbrecht Avatar answered Oct 24 '22 13:10

Chris Aelbrecht


By looking at the commands you are running, it seems like you are trying to use the installed npm module as an external command. You can achieve this only by installing the module globally:

npm install -g openssl

The warnings you get are expected. Each time you install a module locally, npm will try to update your package.json with the dependency to the module. Since you probably don't have a package.json in your home directory, you get the warning.

like image 35
mihai Avatar answered Oct 24 '22 14:10

mihai