Error: contract source info format must be `<path>:<contractname>` or `<contractname>` user@user:~/src$ forge script script/lib/forge-std/DeploySimpleStorage.s.sol``` I found the lib/forge-std library was missing from my installation as I could not find it by exploring on top right.So subsequently installed it by creating Lib folder and then pasted forge-std inside it. I guess wrong path of folder could be the cause of this error. Please help how to set it correctly. I tried resolving it by copying the DeploySimpleStorage.s.sol and SimpleStorage.sol inside various folders and subfolders but could not make it work. Please help me make it work. "> Error: contract source info format must be `<path>:<contractname>` or `<contractname>` user@user:~/src$ forge script script/lib/forge-std/DeploySimpleStorage.s.sol``` I found the lib/forge-std library was missing from my installation as I could not find it by exploring on top right.So subsequently installed it by creating Lib folder and then pasted forge-std inside it. I guess wrong path of folder could be the cause of this error. Please help how to set it correctly. I tried resolving it by copying the DeploySimpleStorage.s.sol and SimpleStorage.sol inside various folders and subfolders but could not make it work. Please help me make it work. "> Error: contract source info format must be `<path>:<contractname>` or `<contractname>` user@user:~/src$ forge script script/lib/forge-std/DeploySimpleStorage.s.sol``` I found the lib/forge-std library was missing from my installation as I could not find it by exploring on top right.So subsequently installed it by creating Lib folder and then pasted forge-std inside it. I guess wrong path of folder could be the cause of this error. Please help how to set it correctly. I tried resolving it by copying the DeploySimpleStorage.s.sol and SimpleStorage.sol inside various folders and subfolders but could not make it work. Please help me make it work. ">

running a script command in VS code for deploying a solidity smart contract on Foundry

Discussion

I am getting this error while running a solidity script inside VS code for deploying a solidity smart contract "SimpleStorage" on Foundry.

Error: 
contract source info format must be `<path>:<contractname>` or `<contractname>`
user@user:~/src$ forge script script/lib/forge-std/DeploySimpleStorage.s.sol```

I found the lib/forge-std library was missing from my installation as I could not find it by exploring on top right.So subsequently installed it by creating Lib folder and then pasted forge-std inside it. I guess wrong path of folder could be the cause of this error. Please help how to set it correctly. 

I tried resolving it by copying the DeploySimpleStorage.s.sol and SimpleStorage.sol inside various folders and subfolders but could not make it work.  Please help me make it work. 

Answers 1

Hi there, Based on the information you provided, looks like there are two main issues with your project, First please make sure that you've installed foundry correctly, for that visit Foundry Installation Guide.


Now,
The first issue is that it's a best practice to initialize you foundry project using command: forge init project-dir-name --no-commit This way, you make sure that the forge-std library is installed in you project

The second issue is that you should put your main solidity files (ContractName.sol) into the src/directory, script files (DeployContractName.s.sol) in /script directory and test files (ContractnameTest.t.sol) in test/ directory BUT you should not put the libraries like forge-std inside these directories !!
If you're new to foundry and solidity development, please watch Patrick Collin's new foundry course on his youtube channel: Lesson 6 Video

Hope to see you soon on the top, let's keep up the hard work :)