hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

WARNING: You are currently using Node.js v22.0.0

Open engdanilo opened this issue 1 year ago • 1 comments

Version of Hardhat

2.22.3

What happened?

I have a problem to compile Open Zeppelin library

https://github.com/NomicFoundation/hardhat/assets/51862854/b73aabcc-32bf-4d0b-862a-4d82658dbd85

The hardhat error informs that I am using node v22.0.0, but I don't have it installed in my Linux.

Minimal reproduction steps

I am trying to compile a simple smart contract, my node.js is v20.12.2, but when I apply "npx hardhat compile", I receive this message:

WARNING: You are currently using Node.js v22.0.0, which is not supported by Hardhat. This can lead to unexpected behavior. See https://hardhat.org/nodejs-versions

I applied on my Terminal to list all node versions in my linux Ubuntu: nvm ls

And there is no node version 22.0.0 in my computer:

v20.0.0 -> v20.12.2 system default -> 20 (-> v20.12.2) iojs -> N/A (default) unstable -> N/A (default) node -> stable (-> v20.12.2) (default) stable -> 20.12 (-> v20.12.2) (default) lts/* -> lts/iron (-> v20.12.2) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.17.0 (-> N/A) lts/dubnium -> v10.24.1 (-> N/A) lts/erbium -> v12.22.12 (-> N/A) lts/fermium -> v14.21.3 (-> N/A) lts/gallium -> v16.20.2 (-> N/A) lts/hydrogen -> v18.20.2 (-> N/A) lts/iron -> v20.12.2

Because of this I have this problem to use Open Zeppelin library, with this error:

TypeError: No arguments passed to the base constructor. Specify the arguments or mark "DREX" as abstract. --> contracts/DREX.sol:7:1: | 7 | contract DREX is ERC20, Ownable { | ^ (Relevant source part starts here and spans across multiple lines). Note: Base constructor parameters: --> @openzeppelin/contracts/access/Ownable.sol:38:16: | 38 | constructor(address initialOwner) { | ^^^^^^^^^^^^^^^^^^^^^^

TypeError: No arguments passed to the base constructor. Specify the arguments or mark "REAL" as abstract. --> contracts/ERC20.sol:7:1: | 7 | contract REAL is ERC20, Ownable { | ^ (Relevant source part starts here and spans across multiple lines). Note: Base constructor parameters: --> @openzeppelin/contracts/access/Ownable.sol:38:16: | 38 | constructor(address initialOwner) { | ^^^^^^^^^^^^^^^^^^^^^^

Error HH600: Compilation failed

For more info go to https://hardhat.org/HH600 or run Hardhat with --show-stack-traces

Search terms

hardhat WARNING: You are currently using Node.js v22.0.0

engdanilo avatar May 05 '24 19:05 engdanilo

Hi @engdanilo, I don't seem to be getting the same error:

image

Can you provide a minimal reproducible example?

schaable avatar May 06 '24 14:05 schaable

Hi @engdanilo, I'm closing this for bookkeeping reasons, but I'll be happy to reopen it if this issue persists and you can provide more information. Thanks!

schaable avatar May 27 '24 14:05 schaable

@schaable I got the same error First i run npm install hardhat no proplem, run npx hardhart init no problem (generated standard project files/dirs). But run npx hardhat according to tutorial supposed to show tasks options, but I got error: `WARNING: You are currently using Node.js v22.2.0, which is not supported by Hardhat. This can lead to unexpected behavior. See https://hardhat.org/nodejs-versions

Error HH801: Plugin @nomicfoundation/hardhat-toolbox requires the following dependencies to be installed: @nomicfoundation/hardhat-chai-matchers, @nomicfoundation/hardhat-ethers, @nomicfoundation/hardhat-ignition-ethers, @nomicfoundation/hardhat-network-helpers, @nomicfoundation/hardhat-verify, @typechain/ethers-v6, @typechain/hardhat, @types/chai, @types/mocha, chai, ethers, hardhat-gas-reporter, solidity-coverage, ts-node, typechain, typescript. Please run: npm install --save-dev "@nomicfoundation/hardhat-chai-matchers@^2.0.0" "@nomicfoundation/hardhat-ethers@^3.0.0" "@nomicfoundation/hardhat-ignition-ethers@^0.15.0" "@nomicfoundation/hardhat-network-helpers@^1.0.0" "@nomicfoundation/hardhat-verify@^2.0.0" "@typechain/ethers-v6@^0.5.0" "@typechain/hardhat@^9.0.0" "@types/chai@^4.2.0" "@types/mocha@>=9.1.0" "chai@^4.2.0" "ethers@^6.4.0" "hardhat-gas-reporter@^1.0.8" "solidity-coverage@^0.8.1" "ts-node@>=8.0.0" "typechain@^8.3.0" "typescript@>=4.5.0"`

Seem hardhat not support the latest version of nodejs V22. I tried to refer to hardhat doc but told We recommend running Hardhat using the current LTS Node.js version. You can learn about it So i am confusing now.

BI4O avatar Jun 11 '24 08:06 BI4O

Node version releases are here: https://nodejs.org/en/about/previous-releases

Basically node moves through current into active and then maintenance. Hardhat supports active and maintenance. current which is where node 22 is, is designed to give library authors time to support the new version:

Major Node.js versions enter Current release status for six months, which gives library authors time to add support for them.

Node 22 will move to active later in the year.

kanej avatar Jun 11 '24 09:06 kanej