'Version of Node.js which not supperted by hardhat, but I have LTS version of node
I installed nvm in Ubuntu 20.04. Then using nvm I installed node and npm. The general task is to use hardhat in my Solidity project. I created npm project and installed hardhat:
npm init
npm install --save-dev hardhat
Then I created a simple hardhat project: npx hardhat
.
But now, I can't use any tasks from hardhat(like npx hardhat accounts
) due to this error
I use the lts version of node 16.14.2, here is a screen from the command nvm ls
.
I thought that I installed node but not node.js(actually I still don't fully understand the difference between node and node.js), so I installed node.js using sudo apt install nodejs
but this does not help.
So, I don't know what to do, because I have LTS version of node, but seems like hardhat can see this.
Also, I wanted to use hardhat plugin in remix IDE but there is no such plugin
UPD: I think, I found the problem. But I even don't have 17.7.2 version. This is the all versions that I have. So now, I think, I have to somehow say to hardhat my node version
Solution 1:[1]
So, I found answer, it is really stupid from my side. I working in the directory ~/SolidityProjects/testProject. But in ~/ I have directory node_modules which I created(I don't know when, I think I made it at random). So this directory somehow covered node_modules from ~/SolidityProjects/testProject. So I deleted it from ~/ and it start working.
Solution 2:[2]
I was getting a similar issue here. I was running 17.9 but just downgraded by running nvm install 16.0.0
and this seems to have worked
Solution 3:[3]
use following commands:
nvm install 16.0.0
nvm use v16
node --version
node --version to ensure you are using expected nodejs
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Kirill Kuznetsov |
Solution 2 | Dharman |
Solution 3 | tur461 |