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.
This error might be happening because you have a space in the path, Storage SSD
in this case. Try renaming the problem directory to Storage-SSD
or something without a space.