node.js - 在注册表中找不到 "dt~mocha"("npm")

标签 node.js ubuntu typescript mocha.js typescript-typings

我正在尝试在当前的 typescript 项目中设置 mocha 和 chai。

我正在浏览下面的页面来实现相同的功能:-

https://journal.artfuldev.com/write-tests-for-typescript-projects-with-mocha-and-chai-in-typescript-86e053bdb2b6

$ typings install dt~mocha --global --save

我在 Ubuntu 中运行上述命令时遇到错误:-

<小时/>
typings ERR! message Unable to find "dt~mocha" ("npm") in the registry. Did you want to try searching another source? Also, if you want to contribute these typings, please help us: https://github.com/typings/registry
typings ERR! caused by https://api.typings.org/entries/npm/dt~mocha/versions/latest responded with 404, expected it to equal 200

typings ERR! cwd /home/abhishek/Desktop/TypeScript/automation/jasmine
typings ERR! system Linux 3.19.0-47-generic
typings ERR! command "/usr/local/bin/node" "/usr/local/bin/typings" "install" "dt~mocha" "--global" "--save"
typings ERR! node -v v7.7.3
typings ERR! typings -v 0.8.1

typings ERR! If you need help, you may report this error at:
typings ERR!   <https://github.com/typings/typings/issues>
<小时/>

我尝试在互联网上搜索。另外,我尝试了一些方法,但都失败了。

关于如何解决我的问题有什么想法吗?

最佳答案

我浏览了该页面,而不是运行以下命令:-

$ typings install dt~mocha --global --save
$ typings install npm~chai --save

我看到您共享的页面上有一个可以使用的命令:-

现在有另一种方法可以添加类型定义,来自 TypeScript 2.0,因此我们也可以使用它来代替上面提到的打字方法。此方法不依赖于输入 npm 包或模块。要使用它,请键入以下命令:

$ npm install @types/chai @types/mocha --save-dev

我按照其余步骤操作,它成功了!!!

我知道这可能不是最终的解决方案,但应该可以。

关于node.js - 在注册表中找不到 "dt~mocha"("npm"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46054367/

相关文章:

php - 在 Ubuntu/Linux 上正确赋予所有权/权利

python - 使用 conda env 的 apache-airflow systemd 文件

javascript - 如何从具有特定 id 的数组中获取对象并与另一个数组数字进行比较

typescript - 我可以在 TypeScript 中指定值类型,但仍让 TS 推断出键类型吗?

node.js - 运行 Gulp 时为 "Unhandled stream error in pipe"和 "ENOTDIR: not a directory, open"

node.js - 使用 node.js 将视频上传到 youtube

linux - "No more variables left in this MIB View"是什么意思(Linux)?

typescript - Uncaught ReferenceError : require is not defined TypeScript

node.js - 无法全局安装 express

python - 如何在并行运行所有脚本时运行特定命令