smartcontractkit / full-blockchain-solidity-course-js

Learn Blockchain, Solidity, and Full Stack Web3 Development with Javascript
12.25k stars 2.94k forks source link

error: You installed Hardhat with a corrupted lockfile due to the NPM bug #4828. #3816

Closed Kilx-D closed 1 year ago

Kilx-D commented 1 year ago

hardhat compile issue

Whenever I run the command npx hardhat compile I get an error stating the following

Error HH18: You installed Hardhat with a corrupted lockfile due to the NPM bug #4828.

Please delete your node_modules, package-lock.json, reinstall your project, and try again.

This error is created after using the following commands

mkdir hardhat-simple-storage
cd hardhat-simple-storage
npm init -y
npm install hardhat
npx hardhat

after creating a brand new hardhat project, i modified the default solidity file and compiled it by using npx hardhat compile only to result in the error above

I did exactly what it said to do and removed the package-lock file and the node_modules directory and the error still persist.

I looked around online and either there were no helpful solutions to this error that I havent already tried already such as updating npm

i also tried using other OS to see if this was a platform specific issue by using windows 11 and it would just install for forever

stats

OS: kali linux
npm version: 9.1.2
node version: 16.14.2

feel free to ask questions if i didnt clarify enough

alymurtazamemon commented 1 year ago

@Kilx-D It is not a course-related issue, so could you please come to the discussions tab and post your question there? We are very active there.

And close this before that!

Kilx-D commented 1 year ago

@alymurtazamemon Correct me if im wrong but this seems to be a course related issue, at 8:34:56 in the course patrick modifies the default solidity file and compiles it, which is exactly what I did which resulted in the error above.

alymurtazamemon commented 1 year ago

@Kilx-D This seems to be a package-lock.json file issue. Try to delete node_modules folder package-lock.json file and run

npm i --force
Kilx-D commented 1 year ago

@alymurtazamemon i just tried it, it didnt work, everywhere suggest deleting node_modules and package-lock, but every time i do it, it would always result in the same error

alymurtazamemon commented 1 year ago

@alymurtazamemon Please leave your repo link.

Kilx-D commented 1 year ago

i just settled to continue on a linux vm as i couldnt find a solution to making it work on kali linux or windows 11