尝试将 vue-cli 项目迁移到 typescript 时出错

Error when trying to migrate vue-cli project to typescript

我有一个 vue-cli 项目,我想迁移到 typescript。阅读 this,它指出我需要做的只是 运行 以下内容:

vue add typescript

我运行在 Windows 机器上 Git Bash

这会导致以下错误:

Installing vue-cli-plugin-typsecript...

yarn add v1.22.17 [1/4] Resolving packages... info If you think this is a bug, please open a bug report with the information provided in info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command. error An unexpected error occurred: "https://registry.npmjs.org/vue-cli-plugin-typsecript: Not found".
ERROR command failed: yarn add vue-cli-plugin-typsecript -D --tilde

查看错误日志时,我看到:

> Trace:    Error: https://registry.npmjs.org/vue-cli-plugin-typsecript:
> Not found
>       at Request.params.callback [as _callback] (...\npm\node_modules\yarn\lib\cli.js:67029:18)
>       at Request.self.callback (...\npm\node_modules\yarn\lib\cli.js:140883:22)
>       at Request.emit (events.js:314:20)
>       at Request.<anonymous> (...\npm\node_modules\yarn\lib\cli.js:141855:10)
>       at Request.emit (events.js:314:20)
>       at IncomingMessage.<anonymous> (...\npm\node_modules\yarn\lib\cli.js:141777:12)
>       at Object.onceWrapper (events.js:420:28)
>       at IncomingMessage.emit (events.js:326:22)
>       at endReadableNT (_stream_readable.js:1223:12)
>       at processTicksAndRejections (internal/process/task_queues.js:84:21)

我在网上搜索了如何解决这个问题并偶然发现了 this,但是那里建议的每个解决方案都不适合我。 我也试过:

似乎没有任何效果。关于如何解决这个问题有什么想法吗?

正如@lusc 评论的那样,我显然拼错了打字稿,这就是我收到错误的原因。

这个:typsecript而不是

这个:typescript

检查拼写

写错了“typescript”而不是“typesecript”