检查 Nodejs 版本
使用 npm
全局安装 yarn
在项目目录下切换为 yarn v3.0.2
执行 yarn add typescript
添加依赖项,发生报错
具体报错内容如下:
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 0s 295ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ typescript@npm:4.4.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ typescript@patch:typescript@npm%3A4.4.4#~builtin<compat/typescript>::version=4.4.4&hash=32657b can't be found in the cache and will be fetched from the disk
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
at new NodeError (node:internal/errors:371:5)
at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
at PassThrough.emit (node:events:390:28)
at emitCloseNT (node:internal/streams/destroy:145:10)
at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0000: └ Completed in 7s 572ms
➤ YN0000: Failed with errors in 7s 870ms