如果我从外部 HD 运行开发,Next.JS 中的实验性 HTTPS 将不起作用

问题描述 投票:0回答:1

我的所有项目都保存在 Mac Studio M1 的外部 HD 中。我运行任何项目都没有任何问题。就在最近,我发现标志

--experimental-https
不会创建证书,除非我在主硬盘上运行我的项目。

这是错误:

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] }

再次,我已经尝试在我的用户文件夹上运行并且它可以工作,只是当我从外部硬盘运行

npm run dev --experimenta-https
时它不起作用。

next.js https next.js13
1个回答
0
投票
  1. 通过以下方式更新到最新的 Next.js:npm i next@latest React@latest React-dom@latest eslint-config-next@latest 2.将“dev”的package.json脚本更新为:next dev --experimental-https
© www.soinside.com 2019 - 2024. All rights reserved.