今天学习尝试Next.js项目时,执行run dev报错了!找了一下原因,是因为老版本的淘宝镜像已经停用了,需要更换新的!
报错如下
PS F:\nextjslearn\huahan-admin\huahan-admin> npm run dev
> huahan-admin@0.1.0 dev
> next dev
▲ Next.js 14.2.3
✓ Starting...
TypeError: fetch failed
at node:internal/deps/undici/undici:12345:11
at async getVersionInfo (F:\nextjslearn\huahan-admin\huahan-admin\node_modules\next\dist\server\dev\hot-reloader-webpack.js:215:21)
at async Span.traceAsyncFn (F:\nextjslearn\huahan-admin\huahan-admin\node_modules\next\dist\trace\trace.js:154:20)
at async HotReloaderWebpack.start (F:\nextjslearn\huahan-admin\huahan-admin\node_modules\next\dist\server\dev\hot-reloader-webpack.js:607:28)
at async startWatcher (F:\nextjslearn\huahan-admin\huahan-admin\node_modules\next\dist\server\lib\router-utils\setup-dev-bundler.js:156:5)
at async Span.traceAsyncFn (F:\nextjslearn\huahan-admin\huahan-admin\node_modules\next\dist\trace\trace.js:154:20)
at async Server.<anonymous> (F:\nextjslearn\huahan-admin\huahan-admin\node_modules\next\dist\server\lib\start-server.js:249:36) {
cause: Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
errno: -4077,
code: 'ECONNRESET',
syscall: 'read'
}
✓ Ready in 28.9s
解決方案:
npm config set registry https://registry.npmmirror.com
npm config get registry
如果使用yarn 则: yarn config set registry https://registry.npmmirror.com/
Next.js项目run dev报错TypeError: fetch failed by https://oneszhang.com/archives/106.html
真好呢