-<1:%>- cargo build --release
Compiling node-template-runtime v4.0.0-dev (/Users/xuanwenchao/Documents/projects/Rust/substrate-node-template/runtime)
Compiling pallet-poe v4.0.0-dev (/Users/xuanwenchao/Documents/projects/Rust/substrate-node-template/pallets/poe)
Compiling node-template v4.0.0-dev (/Users/xuanwenchao/Documents/projects/Rust/substrate-node-template/node)
Finished release [optimized] target(s) in 1m 27s
-<%>- ./target/release/node-template --tmp --dev
2023-03-30 11:12:50 Running in --dev mode, RPC CORS has been disabled.
2023-03-30 11:12:50 Substrate Node
2023-03-30 11:12:50 ✌️ version 4.0.0-dev-7ce49b8-aarch64-macos
2023-03-30 11:12:50 ❤️ by Substrate DevHub <https://github.com/substrate-developer-hub>, 2017-2023
2023-03-30 11:12:50 Chain specification: Development
2023-03-30 11:12:50 Node name: cooperative-wrench-0354
2023-03-30 11:12:50 Role: AUTHORITY
2023-03-30 11:12:50 Database: RocksDb at /var/folders/8z/hq_yvw055hg0rt8hkgt75ty00000gn/T/substrate7fMllY/chains/dev/db/full
2023-03-30 11:12:50 ⛓ Native runtime: node-template-100 (node-template-1.tx1.au1)
2023-03-30 11:12:50 Initializing Genesis block/state (state: 0xb5fe…b400, header-hash: 0x5c50…c4eb)
2023-03-30 11:12:50 Loading GRANDPA authority set from genesis on what appears to be first startup.
2023-03-30 11:12:50 ⏱ Loaded block-time = 6s from block 0x5c5065188c16e08d10f3ede1344fb8696ee82abf687c7b25947032c15b0dc4eb
2023-03-30 11:12:50 Using default protocol ID "sup" because none is configured in the chain specs
2023-03-30 11:12:50 Local node identity is: 12D3KooWPyuh5L9arf76NwNt4o5TU8VzBTbqRi6aQGBcUyxkmvk4
如果如法连接https://polkadot.js.org/apps/#/explorer
有可能是端口号占用了,启动日志中可以看到
2023-03-30 13:48:07 Highest known block at #0
2023-03-30 13:48:07 Unable to bind RPC server to 127.0.0.1:9933. Trying random port.
2023-03-30 13:48:07 Unable to listen on 127.0.0.1:9944
2023-03-30 13:48:07 Unable to bind RPC server to 127.0.0.1:9944. Trying random port.
2023-03-30 13:48:07 Listening for new connections on 127.0.0.1:49546.
2023-03-30 13:48:12 Starting consensus session on top of parent 0x5c5065188c16e08d10f3ede1344fb8696ee82abf687c7b25947032c15b0dc4eb
方法一:可以用如下命令查看、然后杀掉这个进程,然后重新启动
-<1:%>- netstat -tnl | grep 9944
tcp4 508 0 127.0.0.1.9944 127.0.0.1.64602 CLOSE_WAIT
tcp4 0 0 127.0.0.1.64602 127.0.0.1.9944 FIN_WAIT_2
-<%>- kill 508