enter image description hereHelp me figure out how to install and use hardhat-deploy. After installing it, I add to the hardhat.config.ts file, the line - import "hardhat-deploy"; And when running a node - npx hardhat node, I get an error: TypeError: Cannot read properties of undefined (reading 'length'). If I remove this line from hardhat.config.ts, the terminal does not recognize the command - npx hardhat deploy --network localhost, after starting the node. Where is the mistake?


1 Answer 1


To begin with you should add localhost network to your config which is the default hardhat network. in addition you should add this to your hardhat config:(the main reason)


Furthermore you could use the file naming convention in the deploy folder as official docs said: 000_*.ts

Last but not least you could install hardhat shorthand command to getting ride of npx hardhat haha..

If it's useful please vote it up :)

  • 0xbeny means for the last part, that you can add a scripts entry to package.json, say compile that is npx hardhat compile meaning you can now just run npm run compile. Obviously not much saving but would be more useful for something like npx hardhat run scripts/deploy.js --network goerli.
    – HankCa
    Oct 15, 2023 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.