我在 VSCode 中运行代码并得到 TypeError: Object of type set is not JSON serializable。我刚开始学习编码,实在不懂,google了一下,也不知道JSON可序列化是什么意思。
from solcx import compile_standard
import json
# get the contract content
with open("./SimpleStorage.sol", "r") as file:
simple_storage_file = file.read()
# compile the contract
compiled_sol = compile_standard(
{
"language": "Solidity",
"sources": {"SimpleStorage.sol": {"content": simple_storage_file}},
"settings": {
"outputSelection": {
"*": {
"*": {"abi", "metadata", "evm.bytecode", "evm.bytecode.sourceMap"}
}
}
},
},
solc_version="0.6.0",
)
# creat json file dump the comiled code in it to make it more readable.
with open("compiled_code.json", …Run Code Online (Sandbox Code Playgroud) Mac mini(M1,2020)
蒙特雷
布朗尼 v1.17.2
Nodejs v16.13.4
我正在根据参考资料学习可靠性(https://www.youtube.com/watch?v=M576WGiDBdQ&t=25510s)。
Node.JS 安装没问题
当我尝试这个时
npm install --global yarn
Run Code Online (Sandbox Code Playgroud)
终端给出错误信息
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/yarn
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/yarn'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/yarn'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/yarn'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your …Run Code Online (Sandbox Code Playgroud)