vercel / serve

Static file serving and directory listing
https://npmjs.com/package/serve
MIT License
9.35k stars 687 forks source link

serve 14.2.1 CLI arguments issue http to https #783

Open Maximvdw opened 1 year ago

Maximvdw commented 1 year ago

Description

On Windows, I am getting the following output when executing serve CLI without configuration file or other options: $ npx serve@14.2.1 ./ as non admin.

Any CLI arguments are ignored and used as the serving path. Hence why I think the https issue outlined below is just a result of some CLI argument being "true" even tho it is not used

Output

Serving static path: ./
Generating certificates...
Certificates path: C:\Users\maxim\AppData\Roaming\https-localhost. Never modify nor share this files.
Downloading the mkcert executable...
http to https redirection active.
Running mkcert to generate certificates...
The local CA is already installed in the system trust store! 👍
Note: Firefox support is not available on your platform. ℹ️
ERROR: failed to execute "keytool -importcert": exit status 1

Warning: use -cacerts option to access cacerts keystore
Certificate was added to keystore
keytool error: java.io.FileNotFoundException: C:\Program Files\Java\jdk-17\lib\security\cacerts (Access is denied)

Error: Command failed: "C:\Users\maxim\AppData\Roaming\https-localhost\mkcert-v1.4.3-windows-amd64.exe" -install -cert-file "C:\Users\maxim\AppData\Roaming\https-localhost\localhost.crt" -key-file "C:\Users\maxim\AppData\Roaming\https-localhost\localhost.key" localhost
The local CA is already installed in the system trust store! 👍
Note: Firefox support is not available on your platform. ℹ️
ERROR: failed to execute "keytool -importcert": exit status 1

Warning: use -cacerts option to access cacerts keystore
Certificate was added to keystore
keytool error: java.io.FileNotFoundException: C:\Program Files\Java\jdk-17\lib\security\cacerts (Access is denied)

    at ChildProcess.exithandler (node:child_process:412:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: '"C:\\Users\\maxim\\AppData\\Roaming\\https-localhost\\mkcert-v1.4.3-windows-amd64.exe" -install -cert-file "C:\\Users\\maxim\\AppData\\Roaming\\https-localhost\\localhost.crt" -key-file "C:\\Users\\maxim\\AppData\\Roaming\\https-localhost\\localhost.key" localhost'
}
Unexpected error undefined:

Error: Command failed: "C:\Users\maxim\AppData\Roaming\https-localhost\mkcert-v1.4.3-windows-amd64.exe" -install -cert-file "C:\Users\maxim\AppData\Roaming\https-localhost\localhost.crt" -key-file "C:\Users\maxim\AppData\Roaming\https-localhost\localhost.key" localhost
The local CA is already installed in the system trust store! 👍
Note: Firefox support is not available on your platform. ℹ️
ERROR: failed to execute "keytool -importcert": exit status 1

Warning: use -cacerts option to access cacerts keystore
Certificate was added to keystore
keytool error: java.io.FileNotFoundException: C:\Program Files\Java\jdk-17\lib\security\cacerts (Access is denied)

on 14.2.0 this issue does not exist

Library version

Serving static path: --version Generating certificates... Certificates path: C:\Users\maxim\AppData\Roaming\https-localhost. Never modify nor share this files. Downloading the mkcert executable... http to https redirection active

Node version

v18.12.1