大家好,我是 React 的新手,当我开始我的项目时,我收到 Wepback V5 错误消息
解决更新:https://github.com/facebook/create-react-app/issues/11756#issuecomment-1001162736
这是用什么啊!
Os: Win11
Node : v16
React:v17
React-script : v5
Webpack:v5
Run Code Online (Sandbox Code Playgroud)
此错误消息包含
Crypto
Http
Https
Stream
Run Code Online (Sandbox Code Playgroud)
错误输出
编译有问题:X
ERROR in ./node_modules/eth-lib/lib/bytes.js 9:193-227
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\eth-lib\lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, …Run Code Online (Sandbox Code Playgroud) 我有一个 ipfs 加密的视频 URL。
我无法在 avplayer 中播放视频,但 URL 在 webview 中播放良好。
这是网址: https: //ipfs.moralis.io:2053 /ipfs/QmUjWnQZVVNmTSVak2QDhTxMkn3dPQozxawa1sm3jE5bLr
let currentURL = URL(string: "https://ipfs.moralis.io:2053/ipfs/QmUjWnQZVVNmTSVak2QDhTxMkn3dPQozxawa1sm3jE5bLr")!
let playerItem = AVPlayerItem(url: currentURL)
playerItem.addObserver(self, forKeyPath: "status", options: NSKeyValueObservingOptions(), context: nil)
player = AVPlayer(playerItem: playerItem)let playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = self.avplayerUIView.bounds
self.avplayerUIView.layer.addSublayer(playerLayer)
player.play()
Run Code Online (Sandbox Code Playgroud)
另外,我已将 AVUrlAssets 与视频扩展和视频编解码器一起使用,但视频仍然无法播放
let mimeType = "video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\""
let asset: AVURLAsset = AVURLAsset(url: videoURL!, options: ["AVURLAssetOutOfBandMIMETypeKey" : mimeType])
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个应用程序,其中一部分涉及将 NFT 从我的帐户转移到用户的帐户。以前,我使用 Moralis 来完成此操作,但此代码抛出错误,指出Error: Contract with a Signer cannot override from (operation="overrides.from", code=UNSUPPORTED_OPERATION, version=contracts/5.6.0)
我以前的代码是:
async function giveNFTtoUser(address, token) {
let userWallet = await getAddress();
let web3 = await Moralis.enableWeb3({
chainId: 0x13881,
privateKey:
"{private key for my account}"
});
console.log('in get nft')
const options = {
type: "erc721",
receiver: userWallet,
contractAddress: address,
tokenId: token
};
let transaction = await Moralis.transfer(options);
let result = await transaction.wait();
return result;
}
Run Code Online (Sandbox Code Playgroud)
我如何在 web3 或 ethers 中执行类似的操作,使用不同帐户的私钥将 NFT 从该帐户转移到登录用户的帐户?