Experimental HTTPS in Next.JS doesn't work if I run dev from a external HD
Asked Answered
T

1

1

I have all my projects in an external HD in a Mac Studio M1. I don't have any issues running any of my projects. Just recently I found out that the flag --experimental-https doesn't create a certificate, unless I run my project on my main HD.

This is the error:

Failed to generate self-signed certificate. Falling back to http. Error: Command failed: /Users/username/Library/Caches/mkcert/mkcert-v1.4.4-darwin-arm64 -install -key-file /Volumes/Storage SSD/MyProjects/myproject-next/certificates/localhost-key.pem -cert-file /Volumes/Storage SSD/MyProjects/myproject-next/certificates/localhost.pem localhost 127.0.0.1 ::1
[1]     at checkExecSyncError (node:child_process:885:11)
[1]     at execSync (node:child_process:957:15)
[1]     at createSelfSignedCertificate (/Volumes/Storage SSD/MyProjects/myproject-next/node_modules/next/dist/lib/mkcert.js:123:37)
[1]     at async runDevServer (/Volumes/Storage SSD/MyProjects/myproject-next/node_modules/next/dist/cli/next-dev.js:282:35)
[1]     at async /Volumes/Storage SSD/MyProjects/myproject-next/node_modules/next/dist/cli/next-dev.js:298:9
[1]     at async Span.traceAsyncFn (/Volumes/Storage SSD/MyProjects/myproject-next/node_modules/next/dist/trace/trace.js:105:20)
[1]     at async nextDev (/Volumes/Storage SSD/MyProjects/myproject-next/node_modules/next/dist/cli/next-dev.js:297:5)
[1]     at async main (/Volumes/Storage SSD/MyProjects/myproject-next/node_modules/next/dist/bin/next:156:5) {
[1]   status: 1,
[1]   signal: null,
[1]   output: [ null, null, null ],
[1]   pid: 13219,
[1]   stdout: null,
[1]   stderr: null
[1] }

Again, I already tried running on my user folder and it works, it just doesn't work when I am running npm run dev --experimenta-https from the external HD.

Torrietorrin answered 29/1 at 16:47 Comment(0)
D
0

1 - Update to the latest Next.js via:

npm i next@latest react@latest react-dom@latest eslint-config-next@latest

2.Update package.json script for "dev" running:

 next dev --experimental-https
Diminuendo answered 30/3 at 8:44 Comment(1)
I have this working, I am not asking how to set it up. The issues is about running the project from an external HD.Torrietorrin

© 2022 - 2024 — McMap. All rights reserved.