Solve the problem of ExtendableError: Could not find suitable configuration file when Truffle builds the project environment.

First of all, building a blockchain environment requires a private or public chain. Here, Ganache’s quickstart is used to create a blockchain instance. As shown in the figure below: the red circle represents the port, which will be used to configure truffle-config.js.

insert image description here

Step 2: When using the truffle init command to create a project, the file directory that generally appears is as follows:

.
├── contracts
│ └── Migrations.sol
├── migrations
│ └── 1_initial_migration.js
├── test
├── truffle-config.js
└── truffle.js

The third step is to configure truffle-config.js. Add the following information, remember to change the port, corresponding to the port created by ganache above

module.exports = {
networks: {
development: {
host: “127.0.0.1”, // Localhost (default: none)
port: 7545, // Standard Ethereum port (default: none)
network_id: “*” // Any network (default: none)
}
}
}

At this time, run the **truffle migrate** command directly, and if the following figure appears, the deployment is successful.
insert image description here
If there is an ExtendableError: Could not find suitable configuration file.

Solution: cd into the directory where the truffle-config.js or truffle.js file is located and then run

Guess you like

Origin blog.csdn.net/liuzr_/article/details/126096033