简体   繁体   English

尝试编译我的反应项目时收到大量错误。 我完全不知道这意味着什么或如何开始修复它

[英]Recieving an influx of errors when trying to complie my react project. I quite literally have no idea what it means or how to begin to fix it

Error message follows as such,错误消息如下,

WARNING in ./node_modules/@ethersproject/abi/lib.esm/_version.js
Module Warning (from ./node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\seana\NewReact Folder\my-a 
pp\node_modules\@ethersproject\abi\src.ts\_version.ts' file: Error: ENOENT: no such file or 
directory, open 'C:\Users\seana\NewReact Folder\my- 
app\node_modules\@ethersproject\abi\src.ts\_version.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/fragments.js 6:0-37 7:26-33
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 3:0-117 6:0-204 6:0-204 6:0-204 6:0-204 
 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./src/App.js 16:0-24
 @ ./src/index.js 7:0-24 11:33-36

WARNING in ./node_modules/xhr2-cookies/dist/xml-http-request-upload.js
Module Warning (from ./node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\seana\NewReact Folder\my-app\node_modules\xhr2- 
cookies\xml-http-request-upload.ts' file: Error: ENOENT: no such file or directory, open 
'C:\Users\seana\NewReact Folder\my-app\node_modules\xhr2-cookies\xml-http-request-upload.ts'
 @ ./node_modules/xhr2-cookies/dist/xml-http-request.js 51:32-68
 @ ./node_modules/xhr2-cookies/dist/index.js 11:9-38
 @ ./node_modules/web3-providers-http/lib/index.js 27:11-49
 @ ./node_modules/web3-core-requestmanager/lib/index.js 56:16-46
 @ ./node_modules/web3-core/lib/index.js 23:23-58
 @ ./node_modules/web3/lib/index.js 32:11-31
Module Warning (from ./node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\seana\NewReact Folder\my-app\node_modules\xhr2- 
cookies\xml-http-request.ts' file: Error: ENOENT: no such file or directory, open 
'C:\Users\seana\NewReact Folder\my-app\node_modules\xhr2-cookies\xml-http-request.ts'
 @ ./node_modules/xhr2-cookies/dist/index.js 11:9-38
 @ ./node_modules/web3-providers-http/lib/index.js 27:11-49
 @ ./node_modules/web3-core-requestmanager/lib/index.js 56:16-46
 @ ./node_modules/web3-core/lib/index.js 23:23-58
 @ ./node_modules/web3/lib/index.js 32:11-31
 @ ./src/App.js 16:0-24
 @ ./src/index.js 7:0-24 11:33-36

22 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.65.0 compiled with 22 warnings in 298 ms

(Though these are only two of the errors, there are 22 similar errors. I couldn't upload it because StackOverflow was throwing a weird error.) This problem only arises when I attempt to import web3. (虽然这只是其中的两个错误,但有 22 个类似的错误。我无法上传它,因为 StackOverflow 抛出了一个奇怪的错误。)这个问题仅在我尝试导入 web3 时出现。 I've been troubleshooting and working through this strange web3, webpack dynamic for the whole day.我整天都在对这个奇怪的 web3、webpack 动态进行故障排除和工作。

./src/App.js is as follows. ./src/App.js 如下。

import React, { useState } from 'react'
import { createTheme, ThemeProvider, makeStyles } from '@material-ui/core/styles';
import { Box, Typography, Button, IconButton } from '@material-ui/core';
import NavBar from './components/NavBar';
import './App.css';
import gif from "./images/gif.gif";
import AddIcon from '@material-ui/icons/Add';
import RemoveIcon from '@material-ui/icons/Remove';
import Borg from './borg.mp4';
import { Web3ReactProvider } from '@web3-react/core'
import Web3 from 'web3'

// function getLibrary (provider){
//   return new Web3(provider)
// }

document.body.style = 'background: black;';


const theme = createTheme({
  palette: {
    primary: {
      main: "#FFFFFF",
    },
    secondary: {
      main: "#e1ba8d",
    },
  },
  typography: {
    h1: {
      fontFamily: 'Oswald',
      fontWeight: 1000,
      fontSize: 40,
      lineHeight: '2rem',
    },
    h2: {
      fontFamily: 'Roboto Condensed',
      fontWeight: 500,
      fontSize: 18,
      lineHeight: '2rem',
    },
    h3: {
      fontFamily: 'Oswald',
      fontWeight: 500,
      fontSize: 30,
      lineHeight: '5rem',
    },
    h4: {
      fontFamily: 'Roboto Condensed',
      fontWeight: 1000,
      fontSize: 20,
      lineHeight: '.3rem',
    },
  },
});

const styles = makeStyles({
  root: {
  },
  wrapper: {
    display: 'flex',
    margin: "5em",
  },
  leftSide: {
    textAlign: "start",
    width: '50%'
  },
  rightSide: {
    color: "white",
    width: '50%'
  },
  headerRight: {
    textAlign: 'center',
    marginBottom: '25px'
  },
  boxDesign: {
    display: 'flex',
    alignItems: 'center',
    border: '3px gray solid',
    borderRadius: "10px",
    justifyContent: "space-between",
    padding: '11px',
    width: '70%',
    margin: "0 auto"
  },
  boxDesignTwo: {
    marginTop: '15px',
    display: 'flex',
    alignItems: 'center',
    border: '3px gray solid',
    borderRadius: "10px",
    justifyContent: "space-between",
    padding: '11px',
    width: '70%',
    margin: "0 auto",
    background: 'rgba(255, 255, 255, 0.4)'
  },
  buttonCorlor: {
    color: 'white'
  },
  boxDesignThree: {
    marginTop: '15px',
    display: 'flex',
    alignItems: 'center',
    borderTop: '3px gray solid',
    borderBottom: '3px gray solid',
    justifyContent: "space-between",
    padding: '5px',
    width: '72%',
    margin: "0 auto"
  },
  boxDesignFour: {
    marginTop: '15px',
    display: 'flex',
    padding: '5px',
    width: '73%',
    margin: "0 auto"
  },
  buttonStyle: {
    width: "100%",
    marginBottom: "15px"
  },
  boxDesignFive: {
    textAlign: 'center'
  }
})

function NewlineText(props) {
  const text = props.text;
  return text.split('\n').map(str => <p>{str}</p>);
}



function App() {
  const classes = styles();
  // const classesMint = stylesMint();
  const [total, setTotal] = useState(1);
  return (
    // <Web3ReactProvider> 
    <div>
      <div className = "App">
            <video
            autoPlay
            loop
            muted
            style= {{position: "absolute",
          width: "100%",
          left: "50%",
        top: "50%",
      height: "100%",
    objectFit: "cover",
    transform: "translate(-50%, -50%)",
    zIndex: "-1"
   }}
            >
                <source src= {Borg} type  = "video/mp4"/>
            </video>
        </div>
      <ThemeProvider theme={theme}>
        <NavBar />
        <div className={classes.wrapper}>
          <div className={classes.leftSide}>
            <Typography variant="h1" className={classes.red} color="primary">
              Info
            </Typography>
            <Typography variant="h2" color="secondary">
              December 28th
            </Typography>
            <Typography
              variant="h3" color="primary">
              Limited Mint Date
            </Typography>
            <Typography variant="h4" color="primary">
              December 28 - 5pm EST
            </Typography>
            <Typography variant="h3" color="primary">
              Supply
            </Typography>
            <Typography variant="h4" color="primary">
              777
            </Typography>
            <Typography variant="h3" color="primary">
              Price
            </Typography>
            <Typography variant="h4" color="primary">
              0.08 ETH
            </Typography>
            <Typography variant="h3" color="primary">
              Max
            </Typography>
            <Typography variant="h4" color="primary">
              5 per Wallet
            </Typography>
          </div>
          <div className={classes.rightSide}>
            <Typography variant="h1" className={classes.headerRight} color="primary">
              Limited Sale
            </Typography>
            <Box className={classes.boxDesign}>
              <Box>
                <img src={gif} alt="" width='80px' />
              </Box>
              <Box>
                <Typography color="secondary">
                  Price per NFT
                </Typography>
                <Typography variant="h4" style={{marginTop: '12px'}} color="primary">
                  0.08 ETH Each
                </Typography>
              </Box>
            </Box>
            <Box className={classes.boxDesignTwo}>
              <Box>
                <IconButton onClick={()=>{
                    if (total > 1) {
                      setTotal(total-1)
                    }
                }} 
                aria-label="add" className={classes.buttonCorlor}>
                  <RemoveIcon fontSize="medium" />
                </IconButton>
                {total}
                <IconButton 
                onClick={()=>{
                  if (total < 5) {
                    setTotal(total+1)
                  }
              }} 
                aria-label="add" className={classes.buttonCorlor}>
                  <AddIcon fontSize="medium" />
                </IconButton>
              </Box>
              <Box>
                <Typography variant="h6" color="primary">
                  5 Max
                </Typography>
              </Box>
            </Box>
            <Box className={classes.boxDesignThree}>
              <Box>
              <Typography variant="h6" color="primary">
                  Total
                </Typography>
              </Box>
              <Box>
                <Typography variant="h6" color="primary">
                  {total * 0.08} ETH
                </Typography>
              </Box>
            </Box>
            <Box className={classes.boxDesignFour}>
              <Button className={classes.buttonStyle} variant="contained">Mint Now</Button>
            </Box>
            <Box className={classes.boxDesignFive}>
            <Typography variant="h6" color="primary">
                  765 / 777
                </Typography>
            </Box>
          </div>
        </div>
      </ThemeProvider>
    </div>
  // {/* </Web3ReactProvider> */}
  );
}

export default App;

Yeah, I was trying to set up a react project too until I had the exact problem as you since the last 2 days, finally i managed to find an answer.是的,我也试图建立一个反应项目,直到最近两天我遇到了和你一样的问题,最后我设法找到了答案。 Apparently, react-scripts 5.0.0 doesn't work well with web3 for some reason (I have no idea why, maybe someone can tell), so downgrading the version to 4.0.3 solved the problem for me.显然,由于某种原因,react-scripts 5.0.0 不能很好地与 web3 配合使用(我不知道为什么,也许有人能说出来),所以将版本降级到 4.0.3 为我解决了这个问题。 So here's how to solve: -> Check your react-scripts version in your package.json file.所以这里是如何解决的: -> 在你的 package.json 文件中检查你的 react-scripts 版本。 If it's 5.0.0, type "yarn upgrade react-scripts@4.0.3" to the terminal.如果是 5.0.0,在终端输入“yarn upgrade react-scripts@4.0.3”。 I hope this solves your problem, since it was really annoying to find a solution to this.我希望这可以解决您的问题,因为找到解决方案真的很烦人。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在使用 Mamp,所以我可以将 phpAdmin 用于我的 react native 项目。 如何修复根文件夹 - I'm using Mamp so I can use phpAdmin for my react native project. How can I fix the root folder Lotties 在我的 NextJS 项目中有黑色背景。 我怎样才能使它们透明? - Lotties have a black background in my NextJS project. How can I make them transparent? 我不知道Object(this)的意思 - I have no idea Object(this) means 尝试修复Java Countdown。 我不知道我在做什么 - Trying to fix a Javascript Countdown. I have no idea what I'm doing 新手尝试 react.js 项目。 当我尝试导入图像时,我收到一条无法编译的错误消息 - Newbie trying a react.js project. When I try to import an image I get an error message that it failed to compile 我正在尝试制作 javascript 表单项目。 与反应。 我想把 onChange function 放到输入里面。 但是怎么做? - ı am trying to make javascript form project. with react. I want put onChange function to inside of input. But how? 我正在做一个打字稿项目,我试图让我的编辑按钮“编辑”我选择的行。 但我不知道该怎么做 - I am doing a typescript project and I am trying to make my edit button to “edit” the row that I have selected. But I have no idea on how to do it 当我在终端输入“heroku logs --tail”时如何修复以下错误? 这是什么意思? - How to fix the following errors when I typed in “heroku logs --tail” on my terminal ?? what does it mean? FA 图标没有出现在我的 html 项目的第二页中。 怎么修? - FA icons do not appear in second page of my html project. How to fix? 这是一个反应本机项目。 我的编译器发现 item 变量未定义,即使我在 function 中使用了 item - This is a react native project. My compiler finds the item variable to be undefined even though I used item in a function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM