简体   繁体   中英

WebStorm - discord.js - "Element is not exported"

For some reason, I and many others have had the issue with WebStorm and Discord.js, specifically it doesn't recognize some of the (re-)exported modules from the package; in this case those from Builders seem to be the ones with the issue:

WebStorm 不知道 ButtonStyle

Yet as suggested for discord.js@14.7.1 I do not have Builders installed:

{
  "main": "bot.js",
  "type": "module",
  "engines": {
    "node": "16.x",
    "npm": "7.x"
  },
  "dependencies": {
    "@discordjs/rest": "^0.1.0-canary.0",
    "canvas": "^2.8.0",
    "chart.js": "^3.8.0",
    "chartjs-node-canvas": "^4.1.6",
    "croner": "^4.2.2",
    "discord.js": "^14.7.1",
    "dotenv": "^10.0.0",
    "fs": "^0.0.1-security",
    "fuse.js": "^6.5.3",
    "https": "^1.0.0",
    "i": "^0.3.7",
    "konva": "^8.3.1",
    "mongoose": "^6.1.1",
    "npm": "^8.13.0",
    "path": "^0.12.7",
    "sort-by": "^0.0.2",
    "string-similarity-js": "^2.1.4",
    "url": "^0.11.0"
  }
}

Any ideas why WebStorm fails to know about what Discord.js re-exports?

`-- discord.js@14.7.1                                                        
  `-- @discordjs/builders@1.4.0

You can try installing the discord-api-types library and importing it from there.

import { ButtonStyle } from 'discord-api-types/v10';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM