【发布时间】:2020-11-15 11:11:22
【问题描述】:
我是 typescript 的新手,我发现要使用 npm 包,我首先需要为其安装它的类型,例如
npm install --save @types/node-schedule
但是我也在使用 discord.js,但这不起作用
import * as Discord from 'discord.js';
然后
npm install --save @types/discord.js
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fdiscord.js - Not found
npm ERR! 404
npm ERR! 404 '@types/discord.js@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
我该如何解决这个问题?
【问题讨论】:
-
包名是
discord.js,而不是@types/discord.js。只有在使用 javascript 库或其他不包含类型信息的库时才需要输入。
标签: node.js typescript discord.js