Error during installing bootable USB drive

I'm trying to make bootable USB drive. I've downloaded Mojave installer from app store, erased USB, and used a command in terminal. I got this error:

Error: Error Domain=NSCocoaErrorDomain Code=512 "“BaseSystem.dmg” couldn’t be copied to “SharedSupport”." UserInfo={NSSourceFilePathErrorKey=/Applications/Install macOS Mojave.app/Contents/SharedSupport/BaseSystem.dmg, NSUserStringVariant=(Copy), NSDestinationFilePath=/Volumes/Install macOS Mojave/Install macOS Mojave.app/Contents/SharedSupport/BaseSystem.dmg, NSFilePath=/Applications/Install macOS Mojave.app/Contents/SharedSupport/BaseSystem.dmg, NSUnderlyingError=0x7fcdc61225d0 {Error Domain=NSPOSIXErrorDomain Code=6 "Device not configured"}}The copy of the installer app failed.

How can I fix it?

submitted by /u/Vireon
[link] [comments]