ethereum-boilerplate / ethereum-boilerplate

The ultimate NextJS Ethereum Dapp Boilerplate which gives you maximum flexibility and speed. Feel free to fork and contribute. Although this repo is called "Ethereum Boilerplate" it works with any EVM system and since it uses Moralis SDK You can even use it on Solana! Happy BUIDL!👷‍♂️
https://ethereumboilerplate.com
MIT License
4.07k stars 3.05k forks source link

Failed to compile. #107

Closed ghost closed 2 years ago

ghost commented 2 years ago

I want to clone it. but When running "yarn start". This error is displayed to me in the terminal:

Line 0: Parsing error: ImportDeclaration should appear when the mode is ES6 and in the module context

cvramire commented 2 years ago

i have this error when running yarn install error Couldn't find package "eslint-plugin-import@^2.22.1" required by "react-scripts@4.0.3" on the "npm" registry.

kuabhish commented 2 years ago

solution? facing same issue please

blockjester commented 2 years ago

Seems to be a dependency tree issue, eslint related? Seems there are two versions 8.8.0 and 7.32.0 and they don't get along?

❯ npm ls eslint                                                                                                                      09:11:15 AM
ethereum-boilerplate@0.1.0 /Users/eric/code/crypto/hackathon/ethereum-boilerplate
├─┬ eslint-config-prettier@8.3.0
│ └── eslint@8.8.0 deduped
├─┬ eslint-plugin-prettier@4.0.0
│ └── eslint@8.8.0 deduped
├─┬ eslint-plugin-react-hooks@4.3.0
│ └── eslint@8.8.0 deduped
├─┬ eslint-plugin-react@7.28.0
│ └── eslint@8.8.0 deduped
├─┬ eslint@8.8.0
│ └─┬ eslint-utils@3.0.0
│   └── eslint@8.8.0 deduped
└─┬ react-scripts@4.0.3
  ├─┬ @typescript-eslint/eslint-plugin@4.33.0
  │ ├─┬ @typescript-eslint/experimental-utils@4.33.0
  │ │ ├─┬ eslint-utils@3.0.0
  │ │ │ └── eslint@8.8.0
  │ │ └── eslint@7.32.0
  │ └── eslint@7.32.0 deduped
  ├─┬ @typescript-eslint/parser@4.33.0
  │ └── eslint@7.32.0 deduped
  ├─┬ babel-eslint@10.1.0
  │ └── eslint@7.32.0 deduped
  ├─┬ eslint-config-react-app@6.0.0
  │ └── eslint@7.32.0 deduped
  ├─┬ eslint-plugin-flowtype@5.10.0
  │ └── eslint@7.32.0 deduped
  ├─┬ eslint-plugin-import@2.25.4
  │ └── eslint@7.32.0 deduped
  ├─┬ eslint-plugin-jest@24.7.0
  │ └── eslint@7.32.0 deduped
  ├─┬ eslint-plugin-jsx-a11y@6.5.1
  │ └── eslint@7.32.0 deduped
  ├─┬ eslint-plugin-testing-library@3.10.2
  │ ├─┬ @typescript-eslint/experimental-utils@3.10.1
  │ │ └── eslint@7.32.0 deduped
  │ └── eslint@7.32.0 deduped
  ├─┬ eslint-webpack-plugin@2.6.0
  │ └── eslint@7.32.0 deduped
  └── eslint@7.32.0
ghost commented 2 years ago

blockjester

What is the solution?

kuabhish commented 2 years ago

what I did is went to a older commit and it worked.

CodeXSky commented 2 years ago

@kuabhish if you checkout to older commit, it probably missing files config. Anyone else have solution for update eslint to resolve this?

blockjester commented 2 years ago

I do welcome the eslint and prettier.. but spent the better part of today banging my head trying to fix this by checkout out an older commit and re-installing. Still doesn't work for me.

kuabhish commented 2 years ago

I dont know about this config file @CodeXSky but going to commit cfffb45755287226ab01f560343a5442cd9ec313 worked for me @blockjester

YosephKS commented 2 years ago

Hey @kuabhish @CodeXSky @blockjester @CyrusSaei @cvramire if you are having the latest version of ethereum-boilerplate :raised_hands:

if any of you get this error

 Line 0:  Parsing error: ImportDeclaration should appear when the mode is ES6 and in the module context

then, simply replace the content of your .eslintrc with this

{
  "settings": {
    "react": {
      "version": "detect"
    }
  },
  "env": {
    "browser": true,
    "node": true,
    "es2021": true,
    "jest": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:react/jsx-runtime",
    "plugin:react/recommended",
    "plugin:prettier/recommended",
    "plugin:react-hooks/recommended"
  ],
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 12,
    "sourceType": "module"
  },
  "plugins": ["react"],
  "rules": {
    "react/react-in-jsx-scope": "off",
    "react/prop-types": "off",
    "react/jsx-key": "off",
    "react/no-unescaped-entities": "off"
  }
}

What I do is:

  1. set "ecmaVersion": 12
  2. add some new rules to off

I'll try to make a patch PR to fix this next ASAP.

YosephKS commented 2 years ago

Thank you again y'all @kuabhish @CodeXSky @blockjester @CyrusSaei @cvramire for reporting, a patch fix PR is on its way 🙌🏼 appreciate all your inputs

YosephKS commented 2 years ago

Alright fixed guys 🙌🏼 pull the latest version and have a check and let us know~

ghost commented 2 years ago

YosephKS

Thanks so much 🙏

blockjester commented 2 years ago

Thank you!

CodeXSky commented 2 years ago

Alright fixed guys 🙌🏼 pull the latest version and have a check and let us know~

Thank you !

ghost commented 2 years ago

1 hour ago I have downloaded, then installed packages and complied using both npm and yarn but got a lot of errors. Below are the last lines of the errors

ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 39:12-28
Module not found: Error: Can't resolve 'https' in '/Users/ajay/Bloackchain/codes/ethereum-boilerplate/node_modules/xhr2-cookies/dist'

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, you need to:
        - add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
        - install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "https": false }
 @ ./node_modules/xhr2-cookies/dist/index.js 11:9-38
 @ ./node_modules/@walletconnect/http-connection/dist/esm/index.js 2:0-46 4:47-61
 @ ./node_modules/@walletconnect/web3-provider/dist/esm/index.js 3:0-60 338:22-36
 @ ./node_modules/moralis/lib/browser/Web3Connector/WalletConnectWeb3Connector.js 160:54-93
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 83:57-110
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5335:11-24
 @ ./src/index.js 7:0-48 21:48-63

ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 41:9-22
Module not found: Error: Can't resolve 'os' in '/Users/ajay/Bloackchain/codes/ethereum-boilerplate/node_modules/xhr2-cookies/dist'

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, you need to:
        - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
        - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "os": false }
 @ ./node_modules/xhr2-cookies/dist/index.js 11:9-38
 @ ./node_modules/@walletconnect/http-connection/dist/esm/index.js 2:0-46 4:47-61
 @ ./node_modules/@walletconnect/web3-provider/dist/esm/index.js 3:0-60 338:22-36
 @ ./node_modules/moralis/lib/browser/Web3Connector/WalletConnectWeb3Connector.js 160:54-93
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 83:57-110
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5335:11-24
 @ ./src/index.js 7:0-48 21:48-63

ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 43:10-24
Module not found: Error: Can't resolve 'url' in '/Users/ajay/Bloackchain/codes/ethereum-boilerplate/node_modules/xhr2-cookies/dist'

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, you need to:
        - add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
        - install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "url": false }
 @ ./node_modules/xhr2-cookies/dist/index.js 11:9-38
 @ ./node_modules/@walletconnect/http-connection/dist/esm/index.js 2:0-46 4:47-61
 @ ./node_modules/@walletconnect/web3-provider/dist/esm/index.js 3:0-60 338:22-36
 @ ./node_modules/moralis/lib/browser/Web3Connector/WalletConnectWeb3Connector.js 160:54-93
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 83:57-110
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5335:11-24
 @ ./src/index.js 7:0-48 21:48-63

ERROR in src/components/Contract/Contract.jsx
  Line 90:34:  Unsafe usage of optional chaining. If it short-circuits with 'undefined' the evaluation will throw TypeError  no-unsafe-optional-chaining

Search for the keywords to learn more about each error.

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

webpack 5.68.0 compiled with 11 errors and 98 warnings in 43797 ms
mrtornado commented 2 years ago

yea I'm getting the same errors :) Somebody messed up the template, yesterday was working just fine :)

Y0moo commented 2 years ago

Hey @mrtornado @ajay67

Please remove your node_modules folder, yarn.lock/package-lock. Fetch new version of the boilerplate and run yarn install

ghost commented 2 years ago

@Y0moo It's now working. Thanks for the quick response.

kushcoin commented 2 years ago

This has been a nightmare.. I have never had so many issues with anything labeled "boilerplate"... Cannot get the environment setup even as there is just so much broken or deprecated crap its ridiculous. Tired of even trying.

Y0moo commented 2 years ago

@kushcoin Please provide some details so I will be able to help you

kushcoin commented 2 years ago

It's requesting I polyfill each module because webpack no longer includes them for node.js i will make a list of other issues too, but I cannot find webpack.config.js