remix-project
remix-project copied to clipboard
Reports of Parse error : source file requires different compiler version
Please see: https://forum.openzeppelin.com/t/remix-compilation-fails-with-source-file-requires-different-compiler-version/6029/9
Bump on this - I literally can't do anything with remix.
Oh how I hate Remix!!!
I HATE IT!!
I'm having the same issue. I'm trying to interact with uniswap but keep getting this error. I tried deleting the github directory as suggested by another user, but still keep getting this error.
Likewise, attempting to compile a contract in the browser Remix with ^0.6.12, having selected 0.6.12, but an eventual import from openzeppelin that has ^0.8.0 (albeit working fine using hardhat compile
), even after moving the .github
directory, still throws the "ParserError" message.
What worked for me for the above:
-
I was using remixd, and needed to:
# get into an elevated interactive shell: sudo -i # (your password) # rather than installing "remixd" plain globally, I had to qualify it: npm i -g @remix-project/remixd # ensure it's 0.5: remixd --version # should output >= 0.5.0
-
Launch the browser version of Remix:
-
Launch remixd:
- I had to use the shared folder path
-s
flag without spaces and without quotes for it to work. If you have spaces in your path, I'd suggest renaming folders until there are no spaces and don't use double-quotes. - I had to copy/paste the exact url, namely:
- with
https
at the beginning - with the
optimize
,runs
,evmVersion
, andversion
params - without a slash at the end
- e.g.
https://remix.ethereum.org/#optimize=true&runs=200&evmVersion=null&version=soljson-v0.8.7+commit.e28d00a7.js
- with
- Paste the URL into the remix-ide url
-u
flag with double-quotes:remixd -s /absolute/path/to/your/shared/dir -u "https://remix.ethereum.org/#optimize=true&runs=200&evmVersion=null&version=soljson-v0.8.7+commit.e28d00a7.js"
- I had to use the shared folder path
-
Return to Remix and select the
File explorers
tab, change theWorkspaces
dropdown to localhost and clickConnect
. Make sure remixd shows at least the line:[INFO] <your locale datetime> remixd is listening on 127.0.0.1:65520
among other lines, and that it doesn't return control to the terminal, it should look like it's hanging.
-
I was able to then compile, select
Injected Web3
to use MetaMask and I was off to the races without open-zeppelin compiler version mismatch errors (despite also using solc < 0.8 as indicated by the error message).
Hope that helps. YMMV. Good luck!
I gave up on a smart contracts concluding that technology this cumbersome and aggravating is doomed to failure.
On Thu, Aug 19, 2021, 10:45 AM Shaun Lerner @.***> wrote:
What worked for me for the above https://github.com/ethereum/remix-project/issues/991#issuecomment-897204893 :
I was using remixd, and needed to:
get into an elevated interactive shell:
sudo -i
(your password)
rather than installing "remixd" plain globally, I had to qualify it:
npm i -g @remix-project/remixd
ensure it's 0.5:
remixd --version
should output >= 0.5.0
Launch the browser version of Remix:
- The -alpha https://remix-alpha.ethereum.org version wasn't working for me, I had to use the regular https://remix.ethereum.org version.
- Select the Solidity Compiler tab and choose your version from the Compiler dropdown to produce the correct URL.
Launch remixd:
I had to use the shared folder path -s flag without spaces and without quotes for it to work. If you have spaces in your path, I'd suggest renaming folders until there are no spaces and don't use double-quotes.
- I had to copy/paste the exact url, namely:
- with https at the beginning
- with the optimize, runs, evmVersion, and version params
- without a slash at the end
- e.g. https://remix.ethereum.org/#optimize=true&runs=200&evmVersion=null&version=soljson-v0.8.7+commit.e28d00a7.js
- Paste the URL into the remix-ide url -u flag with double-quotes:
remixd -s /absolute/path/to/your/shared/dir -u "https://remix.ethereum.org/#optimize=true&runs=200&evmVersion=null&version=soljson-v0.8.7+commit.e28d00a7.js"
Return to Remix and select the File explorers tab, change the Workspaces dropdown to localhost and click Connect. Make sure remixd shows at least the line: [INFO]
remixd is listening on 127.0.0.1:65520 among other lines, and that it doesn't return control to the terminal, it should look like it's hanging. 5. I was able to then compile, select Injected Web3 to use MetaMask and I was off to the races without open-zeppelin compiler version mismatch errors (despite also using solc < 0.8 as indicated by the error message).
Hope that helps. YMMV. Good luck!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ethereum/remix-project/issues/991#issuecomment-902023538, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVLZWP5FFHGZQ66SXNKGBLT5URKBANCNFSM4ZSKYM5Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
This problem still continues in Remix 0.21.1, hosted version. Oddly, this particular version of Remix only allows single compiler version:
latest local version - soljson-v0.8.7+commit.e28d00a7.js
When trying to compile MyLootBox.sol example from OpenZeppellin, following error is thrown.
ParserError: Source file requires different compiler version (current compiler is 0.8.7+commit.e28d00a7.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version
--> MyLootBox.sol:1:1:
|
1 | pragma solidity ^0.5.11;
| ^^^^^^^^^^^^^^^^^^^^^^^^
I have faced with this issue while trying to compile a contract with Solidity ver 0.6.6.
dependencies are:
- Remix IDE v0.25
- Remix daemon v0.6.2
- Windows 10
- Solidity version 0.6.6
It was compiled after when I changed pragma version from 0.6.6 to 0.8.15, which is the latest Solidity version at the time.