preact-cli: Can't generate certificates on fresh install
Steps to reproduce:
npm install -g preact-cli
preact create <app> --yarn
cd <app>
yarn serve
Result:
Setting up SSL certificate (may require sudo)...
INFO: Could not find files for the given pattern(s).
Attempting to spawn simplehttp2server to generate cert.
Failed to generate dev SSL certificate: Error: spawn C:\<app_dir>\node_modules\simplehttp2server\vendor\simplehttp2server_windows_amd64.exe ENOENT
Falling back to shared directory + simplehttp2server.
(dir: C:\Users\<username>\AppData\Roaming\preact-cli)
server error> Error: spawn C:\<app_dir>\node_modules\simplehttp2server\vendor\simplehttp2server_windows_amd64.exe ENOENT
Error: spawn C:\<app_dir>\node_modules\simplehttp2server\vendor\simplehttp2server_windows_amd64.exe ENOENT
Environment:
OS: Windows 10 x64 Terminal: Powershell (Administrator mode) (PSVersion: 5.1.14393.1480)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 35 (13 by maintainers)
@skdigital Sure, understood. As mentioned it’s not something we actually have control over. The best solution was to just get rid of it going forward. In the interim, you can just use any http server on the production directory. For example, I use
sirv-cli
for testing. There’s no HTTP/2 (yet) but the important part (imo) is to just get it up & running as a sanity check.Thought you might be the most appropriate person talk about this, that’s why I assigned you
Not sure why I’m assigned. This wasn’t a smooth process for me either. Part of the reason why I’ve advocated to get rid of
serve
entirely fornext
release.This is a permissions thing, and we’re totally at the mercy of what
simplehttp2server
is permitted to do.My guess is that it has to do with how users’ machines have installed
node
andnpm
. Specifically, ifsudo
is granted to the installation or not. Since 99% of the reports here are Windows, I’m betting that’s the case.Lol just noticed these issues have been going on for over a year, whats the problem, seems that this devCert thing is causing big issues for windows users. I dont have any of these issues with Nextjs or Reactjs, its just with Preact, I cant build and serve the production version.
I am running into this issue currently, nightmare, tried everything it seems with no luck.
My system:
Windows 10 64bit NVM with Node stable and 11x (on linux subsystem) Node 11x on Windows 10 Latest Preact CLI
I tried:
Steps to reproduce:
Result: yarn run v1.12.3 $ preact build --no-service-worker --template src/template.html && preact serve Setting up SSL certificate (may require sudo)… Attempting to spawn simplehttp2server to generate cert. Failed to generate dev SSL certificate: Error: spawn C:\Users\Sean Knowles\Desktop\Dev\preact\opsap-web\node_modules\simplehttp2server\vendor\simplehttp2server_windows_amd64.exe ENOENT Falling back to shared directory + simplehttp2server. (dir: C:\Users\Sean Knowles\AppData\Roaming\preact-cli)
server error> Error: spawn C:\Users\Sean Knowles\Desktop\Dev\preact\opsap-web\node_modules\simplehttp2server\vendor\simplehttp2server_windows_amd64.exe ENOENT Error: spawn C:\Users\Sean Knowles\Desktop\Dev\preact\opsap-web\node_modules\simplehttp2server\vendor\simplehttp2server_windows_amd64.exe ENOENT
error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
For the record, I had a similar issue but it wouldn’t even work within WSL or Git Bash.
Turned out
npm install
didn’t runsimplehttp2server
’s install script so thenode_modules/simplehttp2server/vendor/simplehttp2server_windows_amd64.exe
file really didn’t exist. A simplenpm install --no-save simplehttp2server
fixed it for me.