在普通的 discord.js 上安装 discordjs/opus 有错误
Posted
技术标签:
【中文标题】在普通的 discord.js 上安装 discordjs/opus 有错误【英文标题】:Installing discordjs/opus over normal discord.js has an error 【发布时间】:2021-05-10 17:45:51 【问题描述】:最近,我问了一个问题,是否可以在已安装的 discordjs here 之上安装 discordjs/opus。我被告知它可能不会有任何问题,但事实并非如此。这是它在安装时发送的错误:
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\MYNAME\OneDrive\Documents\GitHub\discordbot\node_modules\ws\package.json.3640863801
npm ERR! dest C:\Users\MYNAME\OneDrive\Documents\GitHub\discordbot\node_modules\ws\package.json
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\MYNAME\OneDrive\Documents\GitHub\discordbot\node_modules\ws\package.json.3640863801' -> 'C:\Users\MYNAME\OneDrive\Documents\GitHub\beansdiscordbot\node_modules\ws\package.json'
npm ERR! [OperationalError: EPERM: operation not permitted, rename 'C:\Users\MYNAME\OneDrive\Documents\GitHub\discordbot\node_modules\ws\package.json.3640863801' -> 'C:\Users\MYNAME\OneDrive\Documents\GitHub\beansdiscordbot\node_modules\ws\package.json']
npm ERR! cause: [Error: EPERM: operation not permitted, rename 'C:\Users\MYNAME\OneDrive\Documents\GitHub\discordbot\node_modules\ws\package.json.3640863801' -> 'C:\Users\MYNAME\OneDrive\Documents\GitHub\beansdiscordbot\node_modules\ws\package.json']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\\Users\\MYNAME\\OneDrive\\Documents\\GitHub\\discordbot\\node_modules\\ws\\package.json.3640863801',
npm ERR! dest: 'C:\\Users\\MYNAME\\OneDrive\\Documents\\GitHub\\discordbot\\node_modules\\ws\\package.json'
npm ERR! ,
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\\Users\\MYNAME\\OneDrive\\Documents\\GitHub\\discordbot\\node_modules\\ws\\package.json.3640863801',
npm ERR! dest: 'C:\\Users\\MYNAME\\OneDrive\\Documents\\GitHub\\discordbot\\node_modules\\ws\\package.json',
npm ERR! parent: 'discordbot'
npm ERR!
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
(我用“MYNAME”替换了我的真实姓名)
如果我能解决这个问题,我们将不胜感激。
【问题讨论】:
【参考方案1】:您应该使用右键单击 > 以管理员身份运行来打开 Powershell。并重试。它会起作用,这是一个简单的权限问题。
【讨论】:
刚试过这个并运行 npm install discord.js @discordjs/opus,然后它说这个错误:Error: Cannot find module 'discord.js'
我不得不回滚,因为它崩溃了。您能否就如何解决此问题提供任何建议/帮助:)?
使用 npm install discord.js以上是关于在普通的 discord.js 上安装 discordjs/opus 有错误的主要内容,如果未能解决你的问题,请参考以下文章
Discord.js 机器人的代码响应错误“TypeError:”
Node.js + Discord.js:无法读取未定义的属性“类”
**已解决** discord.js guildMemberAdd() 未向对象添加正确的值
如何添加一种方法来检查某人是不是已经在部落中/或者他们是不是是 Discord 中的部落所有者 - Discord.JS